Update app.py
Browse files
app.py
CHANGED
|
@@ -11,22 +11,20 @@ def convert_to_mp4_with_aac(input_path, output_path):
|
|
| 11 |
|
| 12 |
return output_path
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
def execute_command(command: str) -> None:
|
| 17 |
subprocess.run(command, check=True)
|
| 18 |
|
| 19 |
-
def infer():
|
| 20 |
|
| 21 |
output_name = "acknowledgement_english@M030_front_neutral_level1_001@male_face"
|
| 22 |
|
| 23 |
command = [
|
| 24 |
f"python",
|
| 25 |
f"inference_for_demo_video.py",
|
| 26 |
-
f"--wav_path=
|
| 27 |
f"--style_clip_path=data/style_clip/3DMM/M030_front_neutral_level1_001.mat",
|
| 28 |
f"--pose_path=data/pose/RichardShelby_front_neutral_level1_001.mat",
|
| 29 |
-
f"--image_path=
|
| 30 |
f"--cfg_scale=1.0",
|
| 31 |
f"--max_gen_len=30",
|
| 32 |
f"--output_name={output_name}"
|
|
@@ -40,20 +38,21 @@ def infer():
|
|
| 40 |
|
| 41 |
result = convert_to_mp4_with_aac(input_file, output_file)
|
| 42 |
|
| 43 |
-
|
| 44 |
return result
|
| 45 |
|
| 46 |
with gr.Blocks() as demo:
|
| 47 |
with gr.Column():
|
| 48 |
with gr.Row():
|
| 49 |
with gr.Column():
|
|
|
|
|
|
|
| 50 |
run_btn = gr.Button("Run")
|
| 51 |
with gr.Column():
|
| 52 |
output_video = gr.Video(format="mp4")
|
| 53 |
|
| 54 |
run_btn.click(
|
| 55 |
fn = infer,
|
| 56 |
-
inputs = [],
|
| 57 |
outputs = [output_video]
|
| 58 |
)
|
| 59 |
|
|
|
|
| 11 |
|
| 12 |
return output_path
|
| 13 |
|
|
|
|
|
|
|
| 14 |
def execute_command(command: str) -> None:
|
| 15 |
subprocess.run(command, check=True)
|
| 16 |
|
| 17 |
+
def infer(audio_input, image_path):
|
| 18 |
|
| 19 |
output_name = "acknowledgement_english@M030_front_neutral_level1_001@male_face"
|
| 20 |
|
| 21 |
command = [
|
| 22 |
f"python",
|
| 23 |
f"inference_for_demo_video.py",
|
| 24 |
+
f"--wav_path={audio_input}",
|
| 25 |
f"--style_clip_path=data/style_clip/3DMM/M030_front_neutral_level1_001.mat",
|
| 26 |
f"--pose_path=data/pose/RichardShelby_front_neutral_level1_001.mat",
|
| 27 |
+
f"--image_path={image_path}",
|
| 28 |
f"--cfg_scale=1.0",
|
| 29 |
f"--max_gen_len=30",
|
| 30 |
f"--output_name={output_name}"
|
|
|
|
| 38 |
|
| 39 |
result = convert_to_mp4_with_aac(input_file, output_file)
|
| 40 |
|
|
|
|
| 41 |
return result
|
| 42 |
|
| 43 |
with gr.Blocks() as demo:
|
| 44 |
with gr.Column():
|
| 45 |
with gr.Row():
|
| 46 |
with gr.Column():
|
| 47 |
+
image_path = gr.Image(label="Image", sources=["upload"])
|
| 48 |
+
audio_input = gr.Audio(label="Audio input", type="filepath", sources=["upload"])
|
| 49 |
run_btn = gr.Button("Run")
|
| 50 |
with gr.Column():
|
| 51 |
output_video = gr.Video(format="mp4")
|
| 52 |
|
| 53 |
run_btn.click(
|
| 54 |
fn = infer,
|
| 55 |
+
inputs = [audio_input, image_path],
|
| 56 |
outputs = [output_video]
|
| 57 |
)
|
| 58 |
|