Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -137,12 +137,14 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, up
|
|
137 |
if upscale == "Yes":
|
138 |
torch.cuda.max_memory_allocated(device=device)
|
139 |
torch.cuda.empty_cache()
|
|
|
|
|
|
|
140 |
sdxl = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True, torch_dtype=torch.float16, variant="fp16") if torch.cuda.is_available() else DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0")
|
141 |
sdxl.enable_xformers_memory_efficient_attention()
|
142 |
sdxl = sdxl.to(device)
|
143 |
torch.cuda.empty_cache()
|
144 |
-
|
145 |
-
torch.cuda.empty_cache()
|
146 |
refined = sdxl(Prompt, negative_prompt=negative_prompt, image=image, denoising_start=high_noise_frac).images[0]
|
147 |
torch.cuda.empty_cache()
|
148 |
return refined
|
|
|
137 |
if upscale == "Yes":
|
138 |
torch.cuda.max_memory_allocated(device=device)
|
139 |
torch.cuda.empty_cache()
|
140 |
+
image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, output_type="latent").images
|
141 |
+
torch.cuda.empty_cache()
|
142 |
+
|
143 |
sdxl = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True, torch_dtype=torch.float16, variant="fp16") if torch.cuda.is_available() else DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0")
|
144 |
sdxl.enable_xformers_memory_efficient_attention()
|
145 |
sdxl = sdxl.to(device)
|
146 |
torch.cuda.empty_cache()
|
147 |
+
|
|
|
148 |
refined = sdxl(Prompt, negative_prompt=negative_prompt, image=image, denoising_start=high_noise_frac).images[0]
|
149 |
torch.cuda.empty_cache()
|
150 |
return refined
|