import os import sys import gradio as gr import time import subprocess os.system('git clone https://github.com/Rudrabha/Wav2Lip.git') os.system('curl -o ./Wav2Lip/face_detection/detection/sfd/s3fd.pth https://www.adrianbulat.com/downloads/python-fan/s3fd-619a316812.pth') os.system('mv ./Wav2Lip/* .') title = "Wav2Lip Huggingface Interface Test" description = "A simple demo for Wav2Lip Official Repo" article = "Official Repo: https://github.com/Rudrabha/Wav2Lip" def inference(face, audio): os.system("python inference.py --checkpoint_path ./wav2lip.pth --face {} --audio {}".format(face, audio)) # p = subprocess.Popen(('python inference.py --checkpoint_path ./wav2lip.pth --face {} --audio {}', str(i)) # p.wait() fpath = "./results/result_voice.mp4" while not os.path.exists(fpath): time.sleep(1) if os.path.isfile(fpath): return fpath return "./results/result_voice.mp4" iface = gr.Interface(inference, inputs=[gr.inputs.Video(type="mp4", source="upload", label="Talking Face Video (in mp4 format)", optional=False), gr.inputs.Audio(source="upload", type="filepath", label="Audio", optional=False)], outputs=["video"], title=title, description=description, article=article, examples=[], enable_queue=False) iface.launch()