Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -120,11 +120,8 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, up
|
|
120 |
torch.cuda.empty_cache()
|
121 |
torch.cuda.max_memory_allocated(device=device)
|
122 |
image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, output_type="latent").images
|
123 |
-
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")
|
124 |
-
sdxl.enable_xformers_memory_efficient_attention()
|
125 |
-
sdxl = sdxl.to(device)
|
126 |
torch.cuda.empty_cache()
|
127 |
-
refined =
|
128 |
torch.cuda.empty_cache()
|
129 |
return refined
|
130 |
else:
|
|
|
120 |
torch.cuda.empty_cache()
|
121 |
torch.cuda.max_memory_allocated(device=device)
|
122 |
image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, output_type="latent").images
|
|
|
|
|
|
|
123 |
torch.cuda.empty_cache()
|
124 |
+
refined = refiner(Prompt, negative_prompt=negative_prompt, image=image, denoising_start=high_noise_frac).images[0]
|
125 |
torch.cuda.empty_cache()
|
126 |
return refined
|
127 |
else:
|