anir2d2 commited on
Commit
5e081d2
·
verified ·
1 Parent(s): 749ee71

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline
3
+ import torch
4
+
5
+ pipe = StableDiffusionPipeline.from_pretrained(
6
+ "runwayml/stable-diffusion-v1-5",
7
+ torch_dtype=torch.float16
8
+ ).to("cuda")
9
+
10
+ def generate(prompt):
11
+ image = pipe(prompt).images[0]
12
+ return image
13
+
14
+ gr.Interface(fn=generate, inputs="text", outputs="image").launch()