import gradio as gr import os import subprocess # Function to run Wav2Lip model def run_wav2lip(video_path, audio_path): # Define the command to run the Wav2Lip model command = f"python inference.py --face {video_path} --audio {audio_path} --outfile output_result.mp4" # Execute the command subprocess.run(command, shell=True, check=True) # Return the output video file path return "output_result.mp4" # Gradio Interface interface = gr.Interface( fn=run_wav2lip, inputs=[ gr.inputs.Video(label="Input Video"), gr.inputs.Audio(label="Input Audio") ], outputs=gr.outputs.Video(label="Output Video"), title="Wav2Lip Model", description="Upload a video and an audio file to run the Wav2Lip model." ) # Launch the Gradio app if __name__ == "__main__": interface.launch()