capstonedubtrack commited on
Commit
4cbdab1
1 Parent(s): 7c3f6fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -10,11 +10,14 @@ title = "Automatic translation and dubbing for Indic Languages"
10
  description = "A demo application to dub and translate videos spoken in Tamil, Hindi, Bengali and Telugu"
11
  article = "Official Repo: https://github.com/Rudrabha/Wav2Lip"
12
 
13
- def inference(face, audio):
 
 
 
 
14
  os.system("python inference.py --checkpoint_path ./wav2lip_gan.pth --face {} --audio {}".format(face, audio))
15
 
16
  return "./results/result_voice.mp4"
17
 
18
-
19
  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)
20
  iface.launch()
 
10
  description = "A demo application to dub and translate videos spoken in Tamil, Hindi, Bengali and Telugu"
11
  article = "Official Repo: https://github.com/Rudrabha/Wav2Lip"
12
 
13
+ def inference(language,speed,voice,video ):
14
+ import moviepy.editor as mp
15
+ clip = mp.VideoFileClip(video)
16
+ clip.audio.write_audiofile(r"audio.wav")
17
+
18
  os.system("python inference.py --checkpoint_path ./wav2lip_gan.pth --face {} --audio {}".format(face, audio))
19
 
20
  return "./results/result_voice.mp4"
21
 
 
22
  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)
23
  iface.launch()