123LETSPLAY commited on
Commit
1a42e96
1 Parent(s): 3abc530

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import DiffusionPipeline
3
+
4
+ # Load the diffusion pipeline
5
+ pipe = DiffusionPipeline.from_pretrained("ByteDance/AnimateDiff-Lightning")
6
+
7
+ def generate_image(prompt):
8
+ # Generate the image from the prompt
9
+ image = pipe(prompt).images[0]
10
+ return image
11
+
12
+ # Create a Gradio interface
13
+ iface = gr.Interface(
14
+ fn=generate_image,
15
+ inputs=gr.Textbox(label="Enter your prompt", placeholder="e.g. Astronaut in a jungle"),
16
+ outputs=gr.Image(label="Generated Image"),
17
+ title="Diffusion Pipeline Image Generator",
18
+ description="Generate images using a diffusion pipeline based on your prompts."
19
+ )
20
+
21
+ if __name__ == "__main__":
22
+ iface.launch()