123LETSPLAY commited on
Commit
e91c55f
1 Parent(s): da4d1c6

Create app/py

Browse files
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 DiffusionPipeline
3
+
4
+ # Load the Stable Video Diffusion pipeline (image to video model)
5
+ pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-video-diffusion-img2vid-xt")
6
+
7
+ def generate_image(prompt):
8
+ # Generate the image from the prompt
9
+ result = pipe(prompt)
10
+ image = result.images[0] # Extract the first frame
11
+ return image
12
+
13
+ # Create a Gradio interface
14
+ iface = gr.Interface(
15
+ fn=generate_image,
16
+ inputs=gr.Textbox(label="Enter your prompt", placeholder="e.g. Astronaut in a jungle"),
17
+ outputs=gr.Image(label="Generated Image"),
18
+ title="Stable Video Diffusion - Image to Video",
19
+ description="Generate images (first frame) using Stable Video Diffusion based on your prompts."
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ iface.launch()