VideoDubber / app.py
Suparnpreet's picture
Update app.py
8815104 verified
raw
history blame
983 Bytes
import ytdownloader
import trans
import transcribe
import texttospeech
import audioex
from time import sleep
import edit
import streamlit
streamlit.title("Video Dubber")
lang = ['en', 'es', 'fr', 'de', 'it', 'pt', 'pl', 'tr', 'ru', 'nl', 'cs', 'ar', 'zh-cn', 'hu', 'ko', 'ja', 'hi']
def main():
link = streamlit.text_input("Please enter Youtube video link = ")
selected_language = streamlit.selectbox("Select a language:", lang)
if streamlit.button("Submit"):
ytdownloader.download_youtube_video(link, "video")
sleep(5)
audioex.ex()
sleep(5)
video_text = transcribe.transcibe("speech.wav")
sleep(5)
trans_text = trans.mixtral(video_text)
streamlit.text(trans_text)
sleep(5)
texttospeech.speak(trans_text, selected_language)
sleep(5)
edit.mute_and_add_audio("video.mp4", "output.wav", "output_video.mp4")
sleep(5)
streamlit.video("output_video.mp4")
main()