Walmart-the-bag commited on
Commit
2b949d1
β€’
1 Parent(s): ed5e7ba

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import StableDiffusionPipeline
2
+ import torch
3
+ from gradio import Interface, Image
4
+ import gradio
5
+ import spaces
6
+
7
+ model_id = "RunDiffusion/Juggernaut-X-v10"
8
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
9
+ pipe = pipe.to("cuda")
10
+
11
+ @spaces.GPU()
12
+ def text_to_image(prompt):
13
+ image = pipe(prompt).images [0]
14
+ return image
15
+
16
+
17
+ gradio_interface = Interface(
18
+ fn=text_to_image,
19
+ inputs="text",
20
+ outputs=Image(type="pil", show_download_button=True),
21
+ examples=[["person running"]],
22
+ theme=gr.themes.Soft()
23
+ )
24
+ gradio_interface.launch()