GreenGoat commited on
Commit
6207486
·
verified ·
1 Parent(s): f38a3b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -21
app.py CHANGED
@@ -21,11 +21,6 @@ except ImportError:
21
  from PIL import Image
22
  from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
23
  from diffusers import AutoencoderKL, UNet2DConditionModel, DDIMScheduler, EulerAncestralDiscreteScheduler, DPMSolverMultistepScheduler
24
- try:
25
- from diffusers.models.attention_processor import AttnProcessor2_0
26
- except ImportError:
27
- # Fallback for older diffusers versions
28
- AttnProcessor2_0 = None
29
  from transformers import CLIPTextModel, CLIPTokenizer
30
  from enum import Enum
31
  import torch.nn as nn
@@ -137,9 +132,7 @@ if not os.path.exists(model_path):
137
  from huggingface_hub import hf_hub_download
138
  model_path = hf_hub_download(
139
  repo_id="lllyasviel/ic-light",
140
- filename="iclight_sd15_fbc.safetensors",
141
- local_dir="./",
142
- local_dir_use_symlinks=False
143
  )
144
  except Exception as e:
145
  print(f"Failed to download with hf_hub_download: {e}")
@@ -158,16 +151,6 @@ text_encoder = text_encoder.to(device=device, dtype=torch.float16)
158
  vae = vae.to(device=device, dtype=torch.bfloat16)
159
  unet = unet.to(device=device, dtype=torch.float16)
160
 
161
- # Set attention processors
162
- if AttnProcessor2_0 is not None:
163
- try:
164
- unet.set_attn_processor(AttnProcessor2_0())
165
- vae.set_attn_processor(AttnProcessor2_0())
166
- except Exception as e:
167
- print(f"Failed to set attention processors: {e}")
168
- else:
169
- print("AttnProcessor2_0 not available, using default processors")
170
-
171
  # Scheduler
172
  scheduler = DPMSolverMultistepScheduler(
173
  num_train_timesteps=1000,
@@ -572,10 +555,9 @@ def create_demo():
572
  fn=process_relight,
573
  inputs=inputs,
574
  outputs=[result_gallery],
575
- show_progress=True,
576
- queue=True
577
  )
578
- example_prompts.click(lambda x: x[0], inputs=example_prompts, outputs=prompt, show_progress=False, queue=False)
579
 
580
  # Examples - temporarily disabled due to missing image files
581
  # gr.Examples(
 
21
  from PIL import Image
22
  from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline
23
  from diffusers import AutoencoderKL, UNet2DConditionModel, DDIMScheduler, EulerAncestralDiscreteScheduler, DPMSolverMultistepScheduler
 
 
 
 
 
24
  from transformers import CLIPTextModel, CLIPTokenizer
25
  from enum import Enum
26
  import torch.nn as nn
 
132
  from huggingface_hub import hf_hub_download
133
  model_path = hf_hub_download(
134
  repo_id="lllyasviel/ic-light",
135
+ filename="iclight_sd15_fbc.safetensors"
 
 
136
  )
137
  except Exception as e:
138
  print(f"Failed to download with hf_hub_download: {e}")
 
151
  vae = vae.to(device=device, dtype=torch.bfloat16)
152
  unet = unet.to(device=device, dtype=torch.float16)
153
 
 
 
 
 
 
 
 
 
 
 
154
  # Scheduler
155
  scheduler = DPMSolverMultistepScheduler(
156
  num_train_timesteps=1000,
 
555
  fn=process_relight,
556
  inputs=inputs,
557
  outputs=[result_gallery],
558
+ show_progress=True
 
559
  )
560
+ example_prompts.click(lambda x: x[0], inputs=example_prompts, outputs=prompt, show_progress=False)
561
 
562
  # Examples - temporarily disabled due to missing image files
563
  # gr.Examples(