File size: 832 Bytes
f4dbd35
007653c
181c481
007653c
fddd343
181c481
f4dbd35
181c481
 
a780cef
fddd343
 
 
181c481
a780cef
181c481
 
f4dbd35
fddd343
 
 
 
181c481
 
fddd343
f4dbd35
cb78791
fddd343
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from diffusers import StableVideoDiffusionPipeline
import torch

# Model Load करो (CPU पर)
pipe = StableVideoDiffusionPipeline.from_pretrained(
    "stabilityai/stable-video-diffusion-img2vid",
    torch_dtype=torch.float32
)

# Function: Image + Text Prompt से Video बनाएगा
def generate_video(image, prompt):
    video = pipe(image, prompt=prompt).frames
    return video

# Gradio Interface बनाओ
iface = gr.Interface(
    fn=generate_video,
    inputs=[
        gr.Image(label="Upload an image"),
        gr.Textbox(label="Enter Animation Prompt", placeholder="e.g. A cat running in a forest"),
    ],
    outputs=gr.Video(label="Generated Video"),
    title="AI Video Generator",
    description="Upload an image and enter a prompt to generate an AI video."
)

iface.launch()