Manjushri commited on
Commit
71ab9aa
·
1 Parent(s): 4027e0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -13,16 +13,16 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
13
 
14
  pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-0.9", add_to_git_credential=True)
15
  pipe = pipe.to(device)
16
- pipe.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
17
 
18
  refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-0.9")
19
  refiner = refiner.to(device)
20
- refiner.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
21
 
22
  def genie (prompt, negative_prompt, scale, steps, seed):
23
  generator = torch.Generator(device=device).manual_seed(seed)
24
- int_image = pipe(prompt, negative_prompt=negative_prompt, width=768, height=768, num_inference_steps=steps, guidance_scale=scale, num_images_per_prompt=1, generator=generator, output_type="latent").images
25
- image = refiner(prompt=prompt, image=int_image).images
26
  return image
27
 
28
  gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'), gr.Textbox(label='What you Do Not want the AI to generate.'), gr.Slider(1, 15, 10), gr.Slider(1, maximum=100, value=50, step=1), gr.Slider(minimum=1, step=1, maximum=999999999999999999, randomize=True)], outputs='image', title="Stable Diffusion XL .9 CPU", description="SDXL .9 CPU. <b>WARNING:</b> Extremely Slow. 130s/Iteration. Expect 14-28mins an image for 10-20 iterations respectively.", article = "Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>").launch(debug=True, max_threads=True)
 
13
 
14
  pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-0.9", add_to_git_credential=True)
15
  pipe = pipe.to(device)
16
+ pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
17
 
18
  refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-0.9")
19
  refiner = refiner.to(device)
20
+ refiner.unet = torch.compile(refiner.unet, mode="reduce-overhead", fullgraph=True)
21
 
22
  def genie (prompt, negative_prompt, scale, steps, seed):
23
  generator = torch.Generator(device=device).manual_seed(seed)
24
+ int_image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=steps, guidance_scale=scale, num_images_per_prompt=1, generator=generator, output_type="latent").images #width=768, height=768
25
+ image = refiner(prompt=prompt, image=int_image).images[0]
26
  return image
27
 
28
  gr.Interface(fn=genie, inputs=[gr.Textbox(label='What you want the AI to generate. 77 Token Limit.'), gr.Textbox(label='What you Do Not want the AI to generate.'), gr.Slider(1, 15, 10), gr.Slider(1, maximum=100, value=50, step=1), gr.Slider(minimum=1, step=1, maximum=999999999999999999, randomize=True)], outputs='image', title="Stable Diffusion XL .9 CPU", description="SDXL .9 CPU. <b>WARNING:</b> Extremely Slow. 130s/Iteration. Expect 14-28mins an image for 10-20 iterations respectively.", article = "Code Monkey: <a href=\"https://huggingface.co/Manjushri\">Manjushri</a>").launch(debug=True, max_threads=True)