File size: 843 Bytes
29a5d6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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()