Manjushri commited on
Commit
1a63003
1 Parent(s): e9784b1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -24
app.py CHANGED
@@ -79,33 +79,10 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
79
  image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
80
  torch.cuda.empty_cache()
81
  return image
82
-
83
- if Model == 'FusionXL':
84
- torch.cuda.empty_cache()
85
- torch.cuda.max_memory_allocated(device=device)
86
- pipe = DiffusionPipeline.from_pretrained("circulus/canvers-fusionXL-v1", torch_dtype=torch.float16, safety_checker=None) if torch.cuda.is_available() else DiffusionPipeline.from_pretrained("circulus/canvers-real-v3.8.1")
87
- pipe.enable_xformers_memory_efficient_attention()
88
- pipe = pipe.to(device)
89
- torch.cuda.empty_cache()
90
- if refine == "Yes":
91
- torch.cuda.empty_cache()
92
- torch.cuda.max_memory_allocated(device=device)
93
- int_image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale, output_type="latent").images
94
- pipe = 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")
95
- pipe.enable_xformers_memory_efficient_attention()
96
- pipe = pipe.to(device)
97
- torch.cuda.empty_cache()
98
- image = pipe(Prompt, negative_prompt=negative_prompt, image=int_image, denoising_start=high_noise_frac).images[0]
99
- torch.cuda.empty_cache()
100
- return image
101
- else:
102
- image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
103
- torch.cuda.empty_cache()
104
- return image
105
 
106
  return image
107
 
108
- gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Animagine XL 3.0', 'SDXL 1.0', 'FusionXL',], value='PhotoReal', label='Choose Model'),
109
  gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
110
  gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
111
  gr.Slider(512, 1024, 768, step=128, label='Height'),
 
79
  image = sdxl(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
80
  torch.cuda.empty_cache()
81
  return image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  return image
84
 
85
+ gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Animagine XL 3.0', 'SDXL 1.0',], value='PhotoReal', label='Choose Model'),
86
  gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
87
  gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
88
  gr.Slider(512, 1024, 768, step=128, label='Height'),