Spaces:
Runtime error
Runtime error
leeway.zlw commited on
Commit ·
23a0ba6
1
Parent(s): 69c71b8
update
Browse files6 unmodified lines7891010111213141515161718194 unmodified lines242526262728292728293031323379 unmodified lines1131141151151161171181161171181191201211251221231241256 unmodified linesimport argparseimport uuid
is_shared_ui = True if "fudan-generative-ai/hallo" in os.environ['SPACE_ID'] else False# is_shared_ui = True if "fudan-generative-ai/hallo" in os.environ['SPACE_ID'] else Falseis_shared_ui = False
if(not is_shared_ui): hallo_dir = snapshot_download(repo_id="fudan-generative-ai/hallo", local_dir="pretrained_models")
def run_inference(source_image, driving_audio, pose_weight, face_weight, lip_weight, face_expand_ratio, progress=gr.Progress(track_tqdm=True)):def run_inference(source_image, driving_audio, progress=gr.Progress(track_tqdm=True)): if is_shared_ui: raise gr.Error("This Space only works in duplicated instances") 4 unmodified lines source_image=source_image, driving_audio=driving_audio, output=f'output-{unique_id}.mp4', pose_weight=pose_weight, face_weight=face_weight, lip_weight=lip_weight, face_expand_ratio=face_expand_ratio, pose_weight=1.0, face_weight=1.0, lip_weight=1.0, face_expand_ratio=1.2, checkpoint=None ) 79 unmodified lines with gr.Column(): avatar_face = gr.Image(type="filepath", label="Face") driving_audio = gr.Audio(type="filepath", label="Driving audio") pose_weight = gr.Number(label="pose weight", value=1.0), face_weight = gr.Number(label="face weight", value=1.0), lip_weight = gr.Number(label="lip weight", value=1.0), face_expand_ratio = gr.Number(label="face expand ratio", value=1.2), generate = gr.Button("Generate") with gr.Column(): output_video = gr.Video(label="Your talking head")
generate.click( fn=run_inference, inputs=[avatar_face, driving_audio, pose_weight, face_weight, lip_weight, face_expand_ratio], inputs=[avatar_face, driving_audio], outputs=output_video ) app.py+8-11