File size: 669 Bytes
b67dfdb
 
 
 
 
6e3070d
b67dfdb
 
d749140
b67dfdb
d749140
394c760
5a2068e
d749140
 
b67dfdb
6f6c1af
b67dfdb
 
5bd9a13
68b348a
b67dfdb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import random
import subprocess
import os
import gradio
import gradio as gr
import requests


current_dir = os.path.dirname(os.path.abspath(__file__))

def predict(video, audio):
    print(f"Processing video {video} and audio {audio}")
    output_file = f"{current_dir}/results/{random.randint(10,100000)}.mp4"
    command = ["python", "inference.py", "--face", video,
               "--audio", audio, "--outfile", output_file]
    subprocess.run(command, check=True)
    return output_file


demo = gr.Interface(fn=predict, inputs=[gradio.Video(label='Source image/video'),gradio.Audio(type='filepath', label='Target Audio')], outputs=[gradio.Video()])
demo.launch()