Shankarm08 commited on
Commit
e67c735
·
verified ·
1 Parent(s): ee29c53

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import DiffusionPipeline
2
+ from gradio import Gradio
3
+
4
+ # Load the pre-trained model
5
+ pipeline = DiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
6
+
7
+ # Create a Gradio interface
8
+ interface = Gradio(
9
+ pipeline,
10
+ input_prompt="Enter a prompt for the image generation model:",
11
+ output_prompt="Generated image:",
12
+ )
13
+
14
+ # Generate the image
15
+ image = interface(prompt)
16
+
17
+ # Display the generated image
18
+ import matplotlib.pyplot as plt
19
+ plt.imshow(image)
20
+ plt.show()