File size: 619 Bytes
61d629c
0b22425
 
79d3231
61d629c
0b22425
61d629c
afcab5d
61d629c
 
 
 
 
afcab5d
61d629c
 
 
 
 
 
79d3231
61d629c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
import torch
from diffusers import StableVideoDiffusionPipeline

# Load Model
pipe = StableVideoDiffusionPipeline.from_pretrained("stabilityai/stable-video-diffusion-img2vid")
pipe.to("cuda" if torch.cuda.is_available() else "cpu")

def generate_video(prompt):
    video_frames = pipe(prompt, num_inference_steps=50).frames
    video_path = "output.mp4"
    video_frames[0].save(video_path)
    return video_path

iface = gr.Interface(
    fn=generate_video,
    inputs=gr.Textbox(label="Enter Prompt"),
    outputs=gr.Video(label="Generated Video"),
    title="AI Video Generator"
)

iface.launch()