Spaces:
Runtime error
Runtime error
JosefBirman
commited on
Commit
•
b098f80
1
Parent(s):
df07f44
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
import streamlit as st
|
2 |
import whisper
|
3 |
import os
|
4 |
import ffmpeg
|
@@ -120,35 +119,14 @@ def translate_text(input_file:str, output_path:str, lang: str):
|
|
120 |
in_file.close()
|
121 |
out_file.close()
|
122 |
|
123 |
-
|
124 |
-
|
125 |
-
app = Flask(__name__)
|
126 |
-
|
127 |
-
|
128 |
-
@app.route("/")
|
129 |
-
|
130 |
-
def main():
|
131 |
-
audio_dir_name = 'audio'
|
132 |
-
video_dir_name = 'videos'
|
133 |
-
whisper_dir_name = 'whisper_transcripts'
|
134 |
-
current_dir = os.getcwd()
|
135 |
-
audio_dir_path = os.path.join(current_dir, audio_dir_name)
|
136 |
-
video_dir_path = os.path.join(current_dir, video_dir_name)
|
137 |
-
whisper_dir_path = os.path.join(current_dir, whisper_dir_name)
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
os.makedirs(whisper_dir_path)
|
143 |
-
|
144 |
-
|
145 |
-
files = os.listdir(video_dir_path) # accessing all files in audio dir
|
146 |
-
in_file = os.path.join(video_dir_path, files[0]) #grabs first file in the directory
|
147 |
-
|
148 |
-
|
149 |
-
translate_text(transcribe_audio(sep_audio(in_file,audio_dir_path),whisper_dir_path),current_dir,'german')
|
150 |
|
151 |
-
|
|
|
152 |
|
153 |
-
if
|
154 |
-
|
|
|
|
|
|
1 |
import whisper
|
2 |
import os
|
3 |
import ffmpeg
|
|
|
119 |
in_file.close()
|
120 |
out_file.close()
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
+
### FRONT END ###
|
124 |
+
import streamlit as st
|
125 |
+
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
+
pipe = pipeline('video-translation')
|
128 |
+
text = st.text_area('enter a video url!')
|
129 |
|
130 |
+
if text:
|
131 |
+
out = pipe(text)
|
132 |
+
st.json(out)
|