quan1998 commited on
Commit
4197898
·
verified ·
1 Parent(s): a9e7736

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -2,14 +2,19 @@ from diffusers import StableDiffusionXLPipeline
2
  import torch
3
  import gradio as gr
4
 
5
- pipe = StableDiffusionXLPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16)
 
 
 
 
 
6
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
7
 
8
  def greet(prompt):
9
  print(prompt)
10
- images = pipe(prompt=prompt).images[0]
11
- print(images)
12
- return images
13
 
14
  demo = gr.Interface(
15
  fn=greet,
 
2
  import torch
3
  import gradio as gr
4
 
5
+ pipe = StableDiffusionXLPipeline.from_pretrained(
6
+ "stabilityai/stable-diffusion-xl-base-1.0",
7
+ torch_dtype=torch.float16,
8
+ use_safetensors=True,
9
+ variant="fp16"
10
+ )
11
  pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
12
 
13
  def greet(prompt):
14
  print(prompt)
15
+ image = pipe(prompt).images[0]
16
+ print(image)
17
+ return image
18
 
19
  demo = gr.Interface(
20
  fn=greet,