From d8e2ccc8333929f5ddbc544c04ba526e55d3560a Mon Sep 17 00:00:00 2001 From: AricGamma Date: Fri, 21 Jun 2024 13:08:47 +0800 Subject: [PATCH] fix: optimize gradio demo. remove unnecessary options (#76) Co-authored-by: leeway.zlw --- scripts/app.py | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/scripts/app.py b/scripts/app.py index e106c02b..770ffcb1 100644 --- a/scripts/app.py +++ b/scripts/app.py @@ -15,21 +15,12 @@ from inference import inference_process -def predict(image, audio, size, steps, fps, cfg, pose_weight, face_weight, lip_weight, face_expand_ratio): +def predict(image, audio, pose_weight, face_weight, lip_weight, face_expand_ratio, progress=gr.Progress(track_tqdm=True)): """ Create a gradio interface with the configs. """ + _ = progress config = { - 'data': { - 'source_image': { - 'width': size, - 'height': size - }, - 'export_video': { - 'fps': fps - } - }, - 'cfg_scale': cfg, 'source_image': image, 'driving_audio': audio, 'pose_weight': pose_weight, @@ -38,8 +29,7 @@ def predict(image, audio, size, steps, fps, cfg, pose_weight, face_weight, lip_w 'face_expand_ratio': face_expand_ratio, 'config': 'configs/inference/default.yaml', 'checkpoint': None, - 'output': ".cache/output.mp4", - 'inference_steps': steps + 'output': ".cache/output.mp4" } args = argparse.Namespace() for key, value in config.items(): @@ -51,10 +41,6 @@ def predict(image, audio, size, steps, fps, cfg, pose_weight, face_weight, lip_w inputs=[ gr.Image(label="source image (no webp)", type="filepath", format="jpeg"), gr.Audio(label="source audio", type="filepath"), - gr.Number(label="size", value=512, minimum=256, maximum=512, step=64, precision=0), - gr.Number(label="steps", value=40, minimum=1, step=1, precision=0), - gr.Number(label="fps", value=25, minimum=1, step=1, precision=0), - gr.Slider(label="CFG Scale", value=3.5, minimum=0, maximum=10, step=0.01), gr.Number(label="pose weight", value=1.0), gr.Number(label="face weight", value=1.0), gr.Number(label="lip weight", value=1.0),