File size: 1,304 Bytes
142f986
 
 
 
 
 
 
 
674fe8f
142f986
 
 
4cbdab1
 
 
 
 
142f986
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import sys
import gradio as gr

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 = "Automatic translation and dubbing for Indic Languages"
description = "A demo application to dub and translate videos spoken in Tamil, Hindi, Bengali and Telugu"
article = "Official Repo: https://github.com/Rudrabha/Wav2Lip"

def inference(language,speed,voice,video ):
    import moviepy.editor as mp
    clip = mp.VideoFileClip(video)
    clip.audio.write_audiofile(r"audio.wav")
    
    os.system("python inference.py --checkpoint_path ./wav2lip_gan.pth --face {} --audio {}".format(face, audio))

    return "./results/result_voice.mp4"

iface = gr.Interface(inference, inputs=[gr.inputs.Radio(["Tamil", "Hindi", "Bengali", "Telugu"], label = "Enter language to translate to"), gr.inputs.Radio(["Slow", "Fast"], label = "Enter speaking speed"), gr.inputs.Radio(["Male", "Female"], label = "Enter preferred voice"), gr.inputs.Video(type="mp4", source="upload", label="Video to be Translated", optional=False)], outputs=["video"], title=title, description=description, article=article, enable_queue=True)
iface.launch()