Spaces:
Runtime error
Runtime error
Commit
·
fcd9ad1
1
Parent(s):
7fedb38
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,7 +109,8 @@ 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(f"
|
|
|
|
| 113 |
|
| 114 |
ydl_opts = {"outtmpl": filename, "format": "worstvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best"}
|
| 115 |
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
|
@@ -300,6 +301,7 @@ youtube = gr.Interface(
|
|
| 300 |
allow_flagging="never",
|
| 301 |
title=title,
|
| 302 |
examples=[["https://www.youtube.com/watch?v=m8u-18Q0s7I", "transcribe", True]],
|
|
|
|
| 303 |
description=description,
|
| 304 |
article=article,
|
| 305 |
)
|
|
@@ -309,5 +311,5 @@ demo = gr.Blocks()
|
|
| 309 |
with demo:
|
| 310 |
gr.TabbedInterface([microphone, audio_file, youtube], ["Microphone", "Audio File", "YouTube"])
|
| 311 |
|
| 312 |
-
demo.queue(
|
| 313 |
demo.launch()
|
|
|
|
| 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(f"To encourage fair usage of the demo, the maximum YouTube length is {yt_length_limit_hms}, "
|
| 113 |
+
f"got {file_length_hms} YouTube video.")
|
| 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:
|
|
|
|
| 301 |
allow_flagging="never",
|
| 302 |
title=title,
|
| 303 |
examples=[["https://www.youtube.com/watch?v=m8u-18Q0s7I", "transcribe", True]],
|
| 304 |
+
cache_examples=False,
|
| 305 |
description=description,
|
| 306 |
article=article,
|
| 307 |
)
|
|
|
|
| 311 |
with demo:
|
| 312 |
gr.TabbedInterface([microphone, audio_file, youtube], ["Microphone", "Audio File", "YouTube"])
|
| 313 |
|
| 314 |
+
demo.queue(max_size=10)
|
| 315 |
demo.launch()
|