Spaces:
Build error
Build error
fixed last bugs
Browse files
app.py
CHANGED
|
@@ -41,18 +41,13 @@ url_dict = get_durl_myma()
|
|
| 41 |
dict_catalog = get_dict_catalog()
|
| 42 |
|
| 43 |
|
| 44 |
-
def
|
| 45 |
-
|
|
|
|
| 46 |
with yt_dlp.YoutubeDL(
|
| 47 |
{"extract_audio": True, "format": "bestaudio", "outtmpl": file_name}
|
| 48 |
) as video:
|
| 49 |
-
video.download(
|
| 50 |
-
return file_name
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
def download_audio(id_video):
|
| 54 |
-
id = id_video.split("?v=")[-1][:11]
|
| 55 |
-
file_name = download_audio_(id_video)
|
| 56 |
embed_html_all = embed_html1 + id + embed_html2
|
| 57 |
return file_name, embed_html_all
|
| 58 |
|
|
@@ -184,7 +179,7 @@ with gr.Blocks() as demo:
|
|
| 184 |
gr.Dropdown(label="Results", choices=[]),
|
| 185 |
gr.File(None, label="Results as CSV"),
|
| 186 |
gr.Audio(None, label="Results player"),
|
| 187 |
-
gr.HTML(),
|
| 188 |
)
|
| 189 |
|
| 190 |
@audio_url_input.change(
|
|
@@ -205,7 +200,7 @@ with gr.Blocks() as demo:
|
|
| 205 |
gr.Dropdown(choices=[], label="Results"),
|
| 206 |
gr.File(None, label="Results as CSV"),
|
| 207 |
gr.Audio(None, label="Results player"),
|
| 208 |
-
gr.HTML(),
|
| 209 |
)
|
| 210 |
|
| 211 |
analyze_url_btn.click(
|
|
@@ -226,6 +221,8 @@ with gr.Blocks() as demo:
|
|
| 226 |
outputs=[html, csv_results, results],
|
| 227 |
fn=process_url,
|
| 228 |
cache_examples=False,
|
|
|
|
|
|
|
| 229 |
)
|
| 230 |
analyze_file_btn.click(
|
| 231 |
process_file,
|
|
|
|
| 41 |
dict_catalog = get_dict_catalog()
|
| 42 |
|
| 43 |
|
| 44 |
+
def download_audio(id_video):
|
| 45 |
+
id = id_video.split("?v=")[-1][:11]
|
| 46 |
+
file_name = f"youtube_video_{id}.mp3"
|
| 47 |
with yt_dlp.YoutubeDL(
|
| 48 |
{"extract_audio": True, "format": "bestaudio", "outtmpl": file_name}
|
| 49 |
) as video:
|
| 50 |
+
video.download(id_video)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
embed_html_all = embed_html1 + id + embed_html2
|
| 52 |
return file_name, embed_html_all
|
| 53 |
|
|
|
|
| 179 |
gr.Dropdown(label="Results", choices=[]),
|
| 180 |
gr.File(None, label="Results as CSV"),
|
| 181 |
gr.Audio(None, label="Results player"),
|
| 182 |
+
gr.HTML(""),
|
| 183 |
)
|
| 184 |
|
| 185 |
@audio_url_input.change(
|
|
|
|
| 200 |
gr.Dropdown(choices=[], label="Results"),
|
| 201 |
gr.File(None, label="Results as CSV"),
|
| 202 |
gr.Audio(None, label="Results player"),
|
| 203 |
+
gr.HTML(""),
|
| 204 |
)
|
| 205 |
|
| 206 |
analyze_url_btn.click(
|
|
|
|
| 221 |
outputs=[html, csv_results, results],
|
| 222 |
fn=process_url,
|
| 223 |
cache_examples=False,
|
| 224 |
+
examples_per_page=20,
|
| 225 |
+
run_on_click=True,
|
| 226 |
)
|
| 227 |
analyze_file_btn.click(
|
| 228 |
process_file,
|