|
import gradio as gr |
|
from diffusers import DiffusionPipeline |
|
import torch |
|
import tempfile |
|
|
|
|
|
model_id = "cerspense/zeroscope_v2_576w" |
|
pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) |
|
pipe.to("cuda" if torch.cuda.is_available() else "cpu") |
|
|
|
def generate_video(prompt): |
|
output = pipe(prompt, num_inference_steps=25, guidance_scale=9.0) |
|
video_path = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False).name |
|
output["video"].save(video_path, fps=8) |
|
return video_path |
|
|
|
gr.Interface( |
|
fn=generate_video, |
|
inputs=gr.Textbox(label="Enter prompt (e.g. A cat dancing in space)"), |
|
outputs=gr.Video(label="Generated Video"), |
|
title="π¬ Free Prompt-to-Video Generator", |
|
description="Enter a prompt and get a video β 100% free, no login, no API keys." |
|
).launch() |
|
|