Rehman1603's picture
Update app.py
c083126 verified
raw
history blame
1.5 kB
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"],
])
interface.launch(debug=True)