Spaces:
Running
Running
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() |