Icar commited on
Commit
ef56345
1 Parent(s): ac93ecb

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ import diffusers
4
+ pipe=diffusers.StableDiffusionPipeline.from_pretrained('stabilityai/stable-diffusion-2-1',torch_dtype=torch.float16)
5
+ pipe.to('cuda')
6
+ def gen(prompt):
7
+ img=pipe(prompt)[0][0]
8
+ return img
9
+
10
+
11
+ with gr.Blocks() as demo:
12
+ prompt = gr.Textbox(label="Prompt")
13
+ output = gr.Image(label="Output Box")
14
+ greet_btn = gr.Button("Generate")
15
+ greet_btn.click(fn=gen, inputs=prompt, outputs=output, api_name="gen")
16
+ demo.launch(debug=True)