kunalsanga07 commited on
Commit
733cd41
·
verified ·
1 Parent(s): 45e556f

Create app file

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline
3
+ import torch
4
+
5
+ pipe = StableDiffusionPipeline.from_pretrained(
6
+ "CompVis/stable-diffusion-v1-4",
7
+ torch_dtype=torch.float16,
8
+ revision="fp16"
9
+ ).to("cuda")
10
+
11
+ def generate(prompt):
12
+ image = pipe(prompt).images[0]
13
+ return image
14
+
15
+ gr.Interface(
16
+ fn=generate,
17
+ inputs=gr.Textbox(label="Enter your prompt"),
18
+ outputs="image",
19
+ title="🖼️ Open Image Generator",
20
+ description="Enter a prompt and generate an image using Stable Diffusion!"
21
+ ).launch()