USF00 commited on
Commit
438e50a
·
verified ·
1 Parent(s): 98dcc95

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+
4
+ def generate_video(prompt, steps=25, frames=24):
5
+ cmd = [
6
+ "python", "wgp.py",
7
+ "--t2v",
8
+ "--fp16",
9
+ "--advanced",
10
+ "--prompt", prompt,
11
+ "--frames", str(frames),
12
+ "--steps", str(steps),
13
+ "--output", "generated.mp4"
14
+ ]
15
+ try:
16
+ subprocess.run(cmd, check=True)
17
+ return "generated.mp4"
18
+ except Exception as e:
19
+ return str(e)
20
+
21
+ demo = gr.Interface(
22
+ fn=generate_video,
23
+ inputs=[
24
+ gr.Textbox(label="Prompt", value="A boy reading a book under a tree, cinematic"),
25
+ gr.Slider(minimum=5, maximum=60, value=25, step=1, label="Steps"),
26
+ gr.Slider(minimum=16, maximum=80, value=24, step=1, label="Frames")
27
+ ],
28
+ outputs=gr.Video(label="Generated Video")
29
+ )
30
+
31
+ if __name__ == "__main__":
32
+ demo.launch()