File size: 1,560 Bytes
7055298
c750dd1
 
 
 
 
 
 
98c0f61
7055298
 
 
558093b
7055298
558093b
65f08c6
 
7055298
 
 
 
 
 
 
 
 
 
 
19a174e
7055298
65f08c6
19a174e
558093b
65f08c6
36f8179
558093b
c750dd1
 
 
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
32
33
34
35
36
37
38
39
40
import gradio as gr
from Audio_into_chunks import audio_into_chunks_transcribe_translate
from Clear_voice import Clear_voice
from Download_Audio import Downlaod_Audio
from Download_Video import download_video
from Merged_Chunks import Merged_chunks
from Text_to_speech import Text_to_Speech
from Video_dube import Video_dub
import numpy as np

# @title Main Function
def main_fun(video_url,language):
  lang="en"
  if(language=="English"):
    lang="en"
  elif language=="Russian":
    lang="ru"
  elif language=="Arabic":
    lang="ar"
  elif language=="Hindi":
    lang="hi"
  downlaod_video_path=download_video(video_url)
  downlaod_audio_file_path=Downlaod_Audio(downlaod_video_path)
  chunks_translate_data=audio_into_chunks_transcribe_translate(downlaod_audio_file_path,lang)
  voice=Clear_voice()
  output_voice_list=Text_to_Speech(chunks_translate_data,lang,voice)
  merge_voice=Merged_chunks(output_voice_list)
  result=Video_dub(downlaod_video_path,merge_voice)
  return downlaod_video_path,result

interface=gr.Interface(fn=main_fun,inputs=[gr.components.Textbox(label="Enter YouTube Video URL"),gr.components.Radio(['English','Russian','Arabic','Hindi'],type="value")],
                       outputs=[gr.components.Video(label="Original Video"),gr.components.Video(label="Dubb video")],
                      examples=[
                           ["https://www.youtube.com/watch?v=N9B59PHIFbA","Hindi"],
                           ["https://www.youtube.com/watch?v=n0NWsLoMWcs","English"],
                       ])
interface.launch(debug=True)