Manjushri commited on
Commit
b77f3c0
1 Parent(s): 6ad5a35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -372,6 +372,18 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
372
  return upscaled
373
  else:
374
  return refined
 
 
 
 
 
 
 
 
 
 
 
 
375
  return image
376
 
377
  gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0', 'FusionXL', 'SDXL-Turbo'], value='PhotoReal', label='Choose Model'),
 
372
  return upscaled
373
  else:
374
  return refined
375
+
376
+ if upscale == "Yes":
377
+ upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True)
378
+ upscaler.enable_xformers_memory_efficient_attention()
379
+ upscaler = upscaler.to(device)
380
+ torch.cuda.empty_cache()
381
+ upscaled = upscaler(prompt=Prompt, negative_prompt=negative_prompt, image=image, num_inference_steps=5, guidance_scale=0).images[0]
382
+ torch.cuda.empty_cache()
383
+ return upscaled
384
+ else:
385
+ image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
386
+ torch.cuda.empty_cache()
387
  return image
388
 
389
  gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0', 'FusionXL', 'SDXL-Turbo'], value='PhotoReal', label='Choose Model'),