Manjushri commited on
Commit
69149d4
1 Parent(s): b9fa23f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -358,7 +358,14 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
358
  pipe.enable_xformers_memory_efficient_attention()
359
  pipe = pipe.to(device)
360
  image = pipe(prompt=Prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
361
-
 
 
 
 
 
 
 
362
  return image
363
 
364
  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'),
 
358
  pipe.enable_xformers_memory_efficient_attention()
359
  pipe = pipe.to(device)
360
  image = pipe(prompt=Prompt, num_inference_steps=1, guidance_scale=0.0).images[0]
361
+ if refine == "Yes":
362
+ refiner = 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")
363
+ refiner.enable_xformers_memory_efficient_attention()
364
+ refiner = refiner.to(device)
365
+ torch.cuda.empty_cache()
366
+ refined = refiner(Prompt, negative_prompt=negative_prompt, image=image, denoising_start=high_noise_frac).images[0]
367
+ torch.cuda.empty_cache()
368
+
369
  return image
370
 
371
  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'),