|
import torch |
|
from diffusers import MochiPipeline |
|
import gradio as gr |
|
|
|
|
|
pipe = MochiPipeline.from_pretrained("genmo/mochi-1-preview") |
|
|
|
|
|
def generate_video(prompt): |
|
with torch.autocast("cuda", torch.float16): |
|
frames = pipe(prompt, num_frames=30).frames |
|
frames[0].save("mochi.mp4", format="mp4", save_all=True, duration=100) |
|
return "mochi.mp4" |
|
|
|
|
|
interface = gr.Interface( |
|
fn=generate_video, |
|
inputs="text", |
|
outputs="video", |
|
title="Video Generator", |
|
description="Genera un video breve basato sul prompt fornito." |
|
) |
|
|
|
|
|
interface.launch() |
|
|