VideoDubber / app.py
Suparnpreet's picture
Update app.py
ecc6d87 verified
import ytdownloader
import trans
import transcribe
import texttospeech
import audioex
from time import sleep
import edit
import subprocess
try:
subprocess.run("pip uninstall whisper", shell=True)
subprocess.run("pip install -U openai-whisper", shell=True)
except:
pass
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()