Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -100,7 +100,7 @@ def transcribe(inputs, model, language, batch_size, chunk_length_s, stride_lengt
|
|
100 |
|
101 |
except Exception as e:
|
102 |
error_message = str(e)
|
103 |
-
raise gr.Error(error_message, duration=
|
104 |
|
105 |
def _download_yt_audio(yt_url, filename):
|
106 |
info_loader = youtube_dl.YoutubeDL()
|
@@ -127,7 +127,7 @@ def _download_yt_audio(yt_url, filename):
|
|
127 |
if file_length_s > YT_LENGTH_LIMIT_S:
|
128 |
yt_length_limit_hms = time.strftime("%HH:%MM:%SS", time.gmtime(YT_LENGTH_LIMIT_S))
|
129 |
file_length_hms = time.strftime("%HH:%MM:%SS", time.gmtime(file_length_s))
|
130 |
-
raise gr.Error(f"Maximum YouTube length is {yt_length_limit_hms}, got {file_length_hms} YouTube video.", duration=
|
131 |
|
132 |
try:
|
133 |
ydl_opts = {
|
@@ -138,7 +138,7 @@ def _download_yt_audio(yt_url, filename):
|
|
138 |
ydl.download([yt_url])
|
139 |
except youtube_dl.utils.ExtractorError as err:
|
140 |
available_formats = info_loader.extract_info(yt_url, download=False)['formats']
|
141 |
-
raise gr.Error(f"Requested format not available. Available formats: {available_formats}", duration=
|
142 |
|
143 |
def _return_yt_video_id(yt_url):
|
144 |
if "https://www.youtube.com/watch?v=" in yt_url:
|
@@ -264,7 +264,7 @@ def yt_transcribe(yt_url, model, language, batch_size, chunk_length_s, stride_le
|
|
264 |
|
265 |
except Exception as e:
|
266 |
error_message = str(e)
|
267 |
-
gr.Warning(error_message, duration=
|
268 |
return gr.Textbox(visible=False),gr.Textbox(visible=False), gr_title, gr_html, gr_thumbnail, gr_description, gr_keywords
|
269 |
|
270 |
demo = gr.Blocks()
|
|
|
100 |
|
101 |
except Exception as e:
|
102 |
error_message = str(e)
|
103 |
+
raise gr.Error(error_message, duration=20)
|
104 |
|
105 |
def _download_yt_audio(yt_url, filename):
|
106 |
info_loader = youtube_dl.YoutubeDL()
|
|
|
127 |
if file_length_s > YT_LENGTH_LIMIT_S:
|
128 |
yt_length_limit_hms = time.strftime("%HH:%MM:%SS", time.gmtime(YT_LENGTH_LIMIT_S))
|
129 |
file_length_hms = time.strftime("%HH:%MM:%SS", time.gmtime(file_length_s))
|
130 |
+
raise gr.Error(f"Maximum YouTube length is {yt_length_limit_hms}, got {file_length_hms} YouTube video.", duration=20)
|
131 |
|
132 |
try:
|
133 |
ydl_opts = {
|
|
|
138 |
ydl.download([yt_url])
|
139 |
except youtube_dl.utils.ExtractorError as err:
|
140 |
available_formats = info_loader.extract_info(yt_url, download=False)['formats']
|
141 |
+
raise gr.Error(f"Requested format not available. Available formats: {available_formats}", duration=20)
|
142 |
|
143 |
def _return_yt_video_id(yt_url):
|
144 |
if "https://www.youtube.com/watch?v=" in yt_url:
|
|
|
264 |
|
265 |
except Exception as e:
|
266 |
error_message = str(e)
|
267 |
+
gr.Warning(error_message, duration=20)
|
268 |
return gr.Textbox(visible=False),gr.Textbox(visible=False), gr_title, gr_html, gr_thumbnail, gr_description, gr_keywords
|
269 |
|
270 |
demo = gr.Blocks()
|