Update app.py
Browse files10 unmodified lines111213141516171819202122232425262728293031327 unmodified lines404142434445464748495051525354555657585910 unmodified linesreturn output_pathdef execute_command(command: str) -> None:subprocess.run(command, check=True)def infer():output_name = "acknowledgement_english@M030_front_neutral_level1_001@male_face"command = [f"python",f"inference_for_demo_video.py",f"--wav_path=data/audio/acknowledgement_english.m4a",f"--style_clip_path=data/style_clip/3DMM/M030_front_neutral_level1_001.mat",f"--pose_path=data/pose/RichardShelby_front_neutral_level1_001.mat",f"--image_path=data/src_img/uncropped/male_face.png",f"--cfg_scale=1.0",f"--max_gen_len=30",f"--output_name={output_name}"7 unmodified linesresult = convert_to_mp4_with_aac(input_file, output_file)return resultwith gr.Blocks() as demo:with gr.Column():with gr.Row():with gr.Column():run_btn = gr.Button("Run")with gr.Column():output_video = gr.Video(format="mp4")run_btn.click(fn = infer,inputs = [],outputs = [output_video])10 unmodified lines11121314151617181920212223242526272829307 unmodified lines38394041424344454647484950515253545556575810 unmodified linesreturn output_pathdef execute_command(command: str) -> None:subprocess.run(command, check=True)def infer(audio_input, image_path):output_name = "acknowledgement_english@M030_front_neutral_level1_001@male_face"command = [f"python",f"inference_for_demo_video.py",f"--wav_path={audio_input}",f"--style_clip_path=data/style_clip/3DMM/M030_front_neutral_level1_001.mat",f"--pose_path=data/pose/RichardShelby_front_neutral_level1_001.mat",f"--image_path={image_path}",f"--cfg_scale=1.0",f"--max_gen_len=30",f"--output_name={output_name}"7 unmodified linesresult = convert_to_mp4_with_aac(input_file, output_file)return resultwith gr.Blocks() as demo:with gr.Column():with gr.Row():with gr.Column():image_path = gr.Image(label="Image", sources=["upload"])audio_input = gr.Audio(label="Audio input", type="filepath", sources=["upload"])run_btn = gr.Button("Run")with gr.Column():output_video = gr.Video(format="mp4")run_btn.click(fn = infer,inputs = [audio_input, image_path],outputs = [output_video])
app.py+6-7