Manjushri commited on
Commit
b7c779e
1 Parent(s): 0fcef9e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
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
- if upscale == 'Yes':
362
- upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
363
- upscaler.enable_xformers_memory_efficient_attention()
364
- upscaler = upscaler.to(device)
365
- torch.cuda.empty_cache()
366
- upscaled = upscaler(prompt=Prompt, negative_prompt=negative_prompt, image=image, num_inference_steps=5, guidance_scale=0).images[0]
367
- return upscaled
368
- else:
369
- return image
 
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