Spaces:
Runtime error
Runtime error
Commit
·
0500142
1
Parent(s):
e5dbd61
Update app.py
Browse files
app.py
CHANGED
@@ -114,7 +114,7 @@ def VideoTranscribe(video):
|
|
114 |
def YoutubeTranscribe(URL, retries = 5):
|
115 |
if retries:
|
116 |
if "youtu" not in URL.lower():
|
117 |
-
raise Exception(f"{
|
118 |
else:
|
119 |
try:
|
120 |
os.remove("temp_audio.wav")
|
@@ -130,9 +130,9 @@ def YoutubeTranscribe(URL, retries = 5):
|
|
130 |
}
|
131 |
try:
|
132 |
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
133 |
-
ydl.download([
|
134 |
except:
|
135 |
-
return YoutubeTranscribe(
|
136 |
stream = ffmpeg.input('temp_audio.m4a')
|
137 |
stream = ffmpeg.output(stream, 'temp_audio.wav')
|
138 |
try:
|
@@ -141,7 +141,7 @@ def YoutubeTranscribe(URL, retries = 5):
|
|
141 |
pass
|
142 |
return Transcribe()
|
143 |
else:
|
144 |
-
raise Exception(f"Unable to get video from {
|
145 |
|
146 |
with gr.Blocks() as i:
|
147 |
video = gr.Video()
|
|
|
114 |
def YoutubeTranscribe(URL, retries = 5):
|
115 |
if retries:
|
116 |
if "youtu" not in URL.lower():
|
117 |
+
raise Exception(f"{URL} is not a valid youtube URL.")
|
118 |
else:
|
119 |
try:
|
120 |
os.remove("temp_audio.wav")
|
|
|
130 |
}
|
131 |
try:
|
132 |
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
133 |
+
ydl.download([URL])
|
134 |
except:
|
135 |
+
return YoutubeTranscribe(URL, retries-1)
|
136 |
stream = ffmpeg.input('temp_audio.m4a')
|
137 |
stream = ffmpeg.output(stream, 'temp_audio.wav')
|
138 |
try:
|
|
|
141 |
pass
|
142 |
return Transcribe()
|
143 |
else:
|
144 |
+
raise Exception(f"Unable to get video from {URL}")
|
145 |
|
146 |
with gr.Blocks() as i:
|
147 |
video = gr.Video()
|