Manjushri commited on
Commit
157cba0
1 Parent(s): deabf38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -349,10 +349,19 @@ def genie (Model, Prompt, negative_prompt, height, width, scale, steps, seed, re
349
  image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
350
  torch.cuda.empty_cache()
351
  return image
352
-
 
 
 
 
 
 
 
 
 
353
  return image
354
 
355
- gr.Interface(fn=genie, inputs=[gr.Radio(['PhotoReal', 'Anime', 'Disney', 'StoryBook', 'SemiReal', 'Animagine XL 3.0', 'SDXL 1.0', 'FusionXL'], value='PhotoReal', label='Choose Model'),
356
  gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
357
  gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
358
  gr.Slider(512, 1024, 768, step=128, label='Height'),
 
349
  image = pipe(Prompt, negative_prompt=negative_prompt, height=height, width=width, num_inference_steps=steps, guidance_scale=scale).images[0]
350
  torch.cuda.empty_cache()
351
  return image
352
+ if Model == 'SDXL-Turbo':
353
+ #from diffusers import AutoPipelineForText2Image
354
+ #pipe = AutoPipelineForText2Image.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
355
+ #pipe.to("cuda")
356
+ torch.cuda.empty_cache()
357
+ pipe = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16, variant="fp16")
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'),
365
  gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'),
366
  gr.Textbox(label='What you Do Not want the AI to generate. 77 Token Limit'),
367
  gr.Slider(512, 1024, 768, step=128, label='Height'),