Dinesh1102 commited on
Commit
c95e188
·
1 Parent(s): 8997e9d

Create app.py

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