Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -358,15 +358,16 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
|
|
358 |
pipe = pipe.to(device)
|
359 |
image = pipe(prompt=Prompt, negative_prompt=negative_prompt, num_inference_steps=10, prior_num_inference_steps=20, prior_guidance_scale=3.0, width=width, height=height).images[0]
|
360 |
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
|
|
370 |
|
371 |
return image
|
372 |
|
|
|
358 |
pipe = pipe.to(device)
|
359 |
image = pipe(prompt=Prompt, negative_prompt=negative_prompt, num_inference_steps=10, prior_num_inference_steps=20, prior_guidance_scale=3.0, width=width, height=height).images[0]
|
360 |
|
361 |
+
if upscale == 'Yes':
|
362 |
+
torch.cuda.empty_cache()
|
363 |
+
upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
|
364 |
+
upscaler.enable_xformers_memory_efficient_attention()
|
365 |
+
upscaler = upscaler.to(device)
|
366 |
+
torch.cuda.empty_cache()
|
367 |
+
upscaled = upscaler(prompt=Prompt, negative_prompt=negative_prompt, image=image, num_inference_steps=5, guidance_scale=0).images[0]
|
368 |
+
return upscaled
|
369 |
+
else:
|
370 |
+
return image
|
371 |
|
372 |
return image
|
373 |
|