Vijjichenna commited on
Commit
c1d63ae
·
verified ·
1 Parent(s): 11e681f
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import StableDiffusionPipeline
3
+
4
+ # Load the Stable Diffusion model
5
+ model = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
6
+
7
+ def generate_image(prompt):
8
+ # Generate an image based on the prompt
9
+ image = model(prompt).images[0]
10
+ return image
11
+
12
+ # Create a Gradio interface
13
+ interface = gr.Interface(
14
+ fn=generate_image,
15
+ inputs="text",
16
+ outputs="image",
17
+ title="AI Image Generator",
18
+ description="Enter a prompt to generate an image using Stable Diffusion."
19
+ )
20
+
21
+ # Launch the interface
22
+ if __name__ == "__main__":
23
+ interface.launch()