File size: 848 Bytes
438e50a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
import gradio as gr
import subprocess

def generate_video(prompt, steps=25, frames=24):
    cmd = [
        "python", "wgp.py",
        "--t2v",
        "--fp16",
        "--advanced",
        "--prompt", prompt,
        "--frames", str(frames),
        "--steps", str(steps),
        "--output", "generated.mp4"
    ]
    try:
        subprocess.run(cmd, check=True)
        return "generated.mp4"
    except Exception as e:
        return str(e)

demo = gr.Interface(
    fn=generate_video,
    inputs=[
        gr.Textbox(label="Prompt", value="A boy reading a book under a tree, cinematic"),
        gr.Slider(minimum=5, maximum=60, value=25, step=1, label="Steps"),
        gr.Slider(minimum=16, maximum=80, value=24, step=1, label="Frames")
    ],
    outputs=gr.Video(label="Generated Video")
)

if __name__ == "__main__":
    demo.launch()