import streamlit as st import youtubetranscript import youtubevideo import transcriptFromWhisper import sourcetoTarget import textToSpeech from pytube import YouTube link = st.text_input("Youtube Link") st.selectbox("Target Language", ["German"]) btnTranslate = st.button("Translate video") if btnTranslate: video = YouTube(link) videoId = video.video_id wasSuccessful = youtubetranscript.getTranscript(videoId) if(wasSuccessful): fname = video.video_id + ".mp4" youtubevideo.Download(video, fname) st.video(f"videos/{videoId}.mp4") cols = st.columns(3) cols[0].header(f'Original') cols[1].header(f'Whisper') cols[2].header(f'German') file_path = f"transcripts/{videoId}.txt" with open(file_path, 'r', encoding='utf8') as f: cols[0].write(f.read()) transcriptFromWhisper.getWhisperTranscript(videoId) file_path = f"whisper/{videoId}.txt" with open(file_path, 'r') as f: text = f.read() text = text.replace("$","dollar") print(text) cols[1].write(text) sourcetoTarget.englishToGerman(videoId) file_path = f"translatedTranscripts/{videoId}.txt" with open(file_path, 'r', encoding='utf8') as f: cols[2].write(f.read()) textToSpeech.ttsSingleFile(videoId) st.audio(f"tts/{videoId}.wav")