Spaces:
Runtime error
Runtime error
Commit
•
16ca667
1
Parent(s):
5247fcf
Update app.py
Browse files
app.py
CHANGED
@@ -109,8 +109,10 @@ def download_yt_audio(yt_url, filename):
|
|
109 |
if file_length_s > YT_LENGTH_LIMIT_S:
|
110 |
yt_length_limit_hms = time.strftime("%HH:%MM:%SS", time.gmtime(YT_LENGTH_LIMIT_S))
|
111 |
file_length_hms = time.strftime("%HH:%MM:%SS", time.gmtime(file_length_s))
|
112 |
-
raise gr.Error(
|
113 |
-
|
|
|
|
|
114 |
|
115 |
ydl_opts = {"outtmpl": filename, "format": "worstvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"}
|
116 |
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
@@ -308,7 +310,10 @@ youtube = gr.Interface(
|
|
308 |
],
|
309 |
allow_flagging="never",
|
310 |
title=title,
|
311 |
-
examples=[
|
|
|
|
|
|
|
312 |
cache_examples=False,
|
313 |
description=description,
|
314 |
article=article,
|
|
|
109 |
if file_length_s > YT_LENGTH_LIMIT_S:
|
110 |
yt_length_limit_hms = time.strftime("%HH:%MM:%SS", time.gmtime(YT_LENGTH_LIMIT_S))
|
111 |
file_length_hms = time.strftime("%HH:%MM:%SS", time.gmtime(file_length_s))
|
112 |
+
raise gr.Error(
|
113 |
+
f"To encourage fair usage of the demo, the maximum YouTube length is {yt_length_limit_hms}, "
|
114 |
+
f"got {file_length_hms} YouTube video."
|
115 |
+
)
|
116 |
|
117 |
ydl_opts = {"outtmpl": filename, "format": "worstvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"}
|
118 |
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
|
|
310 |
],
|
311 |
allow_flagging="never",
|
312 |
title=title,
|
313 |
+
examples=[
|
314 |
+
["https://www.youtube.com/watch?v=m8u-18Q0s7I", "transcribe", True],
|
315 |
+
["https://www.youtube.com/watch?v=LCOe3a9EHJs", "transcribe", True],
|
316 |
+
],
|
317 |
cache_examples=False,
|
318 |
description=description,
|
319 |
article=article,
|