Faizbulbul commited on
Commit
79d3231
·
verified ·
1 Parent(s): 082e082

requirments.txt

Browse files

gradio
torch
torchvision
diffusers
transformers
accelerate

Files changed (1) hide show
  1. App.py +22 -0
App.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from diffusers import StableVideoDiffusionPipeline
4
+
5
+ # Load Model
6
+ pipe = StableVideoDiffusionPipeline.from_pretrained("stabilityai/stable-video-diffusion-img2vid")
7
+ pipe.to("cuda" if torch.cuda.is_available() else "cpu")
8
+
9
+ def generate_video(prompt):
10
+ video_frames = pipe(prompt, num_inference_steps=50).frames
11
+ video_path = "output.mp4"
12
+ video_frames[0].save(video_path)
13
+ return video_path
14
+
15
+ iface = gr.Interface(
16
+ fn=generate_video,
17
+ inputs=gr.Textbox(label="Enter Prompt"),
18
+ outputs=gr.Video(label="Generated Video"),
19
+ title="AI Video Generator"
20
+ )
21
+
22
+ iface.launch()