Spaces:
Running
on
T4
Running
on
T4
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import subprocess
|
3 |
+
|
4 |
+
def execute_command(command: str) -> None:
|
5 |
+
subprocess.run(command, check=True)
|
6 |
+
|
7 |
+
def infer():
|
8 |
+
|
9 |
+
output_name = "acknowledgement_english@M030_front_neutral_level1_001@male_face"
|
10 |
+
|
11 |
+
command = [
|
12 |
+
f"python",
|
13 |
+
f"inference_for_demo_video.py",
|
14 |
+
f"--wav_path=data/audio/acknowledgement_english.m4a",
|
15 |
+
f"--style_clip_path=data/style_clip/3DMM/M030_front_neutral_level1_001.mat",
|
16 |
+
f"--pose_path=data/pose/RichardShelby_front_neutral_level1_001.mat",
|
17 |
+
f"--image_path=data/src_img/uncropped/male_face.png",
|
18 |
+
f"--cfg_scale=1.0",
|
19 |
+
f"--max_gen_len=30",
|
20 |
+
f"--output_name={output_name}"
|
21 |
+
]
|
22 |
+
|
23 |
+
execute_command(command)
|
24 |
+
|
25 |
+
return f"output_video/{output_name}.mp4"
|
26 |
+
|
27 |
+
with gr.Blocks() as demo:
|
28 |
+
with gr.Column():
|
29 |
+
with gr.Row():
|
30 |
+
with gr.Column():
|
31 |
+
run.btn = gr.Button("Run")
|
32 |
+
with gr.Column():
|
33 |
+
output_video = gr.Video()
|
34 |
+
|
35 |
+
run_btn.click(
|
36 |
+
fn = infer,
|
37 |
+
inputs = [],
|
38 |
+
outputs = [output_video]
|
39 |
+
)
|
40 |
+
|
41 |
+
demo.launch()
|