Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,39 +1,38 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
import audioex
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# pass
|
| 15 |
import streamlit
|
| 16 |
streamlit.title("Video Dubber")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
-
|
|
|
|
| 1 |
+
import ytdownloader
|
| 2 |
+
import trans
|
| 3 |
+
import transcribe
|
| 4 |
+
import texttospeech
|
| 5 |
import audioex
|
| 6 |
+
from time import sleep
|
| 7 |
+
import edit
|
| 8 |
+
import subprocess
|
| 9 |
+
try:
|
| 10 |
+
subprocess.run("pip uninstall whisper", shell=True)
|
| 11 |
+
subprocess.run("pip install -U openai-whisper", shell=True)
|
| 12 |
+
except:
|
| 13 |
+
pass
|
|
|
|
| 14 |
import streamlit
|
| 15 |
streamlit.title("Video Dubber")
|
| 16 |
+
lang = ['en', 'es', 'fr', 'de', 'it', 'pt', 'pl', 'tr', 'ru', 'nl', 'cs', 'ar', 'zh-cn', 'hu', 'ko', 'ja', 'hi']
|
| 17 |
+
def main():
|
| 18 |
+
link = streamlit.text_input("Please enter Youtube video link = ")
|
| 19 |
+
selected_language = streamlit.selectbox("Select a language:", lang)
|
| 20 |
+
if streamlit.button("Submit"):
|
| 21 |
+
ytdownloader.download_youtube_video(link, "video")
|
| 22 |
+
sleep(5)
|
| 23 |
+
audioex.ex()
|
| 24 |
+
sleep(5)
|
| 25 |
+
video_text = transcribe.transcibe("speech.wav")
|
| 26 |
+
sleep(5)
|
| 27 |
+
trans_text = trans.mixtral(video_text)
|
| 28 |
+
streamlit.text(trans_text)
|
| 29 |
+
sleep(5)
|
| 30 |
+
texttospeech.speak(trans_text, selected_language)
|
| 31 |
+
sleep(5)
|
| 32 |
+
edit.mute_and_add_audio("video.mp4", "output.wav", "output_video.mp4")
|
| 33 |
+
sleep(5)
|
| 34 |
+
streamlit.video("output_video.mp4")
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
+
main()
|