Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -243,17 +243,17 @@ def update_audio_player(choice):
|
|
243 |
|
244 |
|
245 |
|
246 |
-
def download_from_url(url_yt,
|
247 |
ydl_opts = {
|
248 |
'format': 'bestaudio/best',
|
249 |
'postprocessors': [{
|
250 |
'key': 'FFmpegExtractAudio',
|
251 |
'preferredcodec': 'wav',
|
252 |
}],
|
253 |
-
"outtmpl": f'audios/{
|
254 |
}
|
255 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
256 |
-
ydl.download([
|
257 |
|
258 |
def audio_downloader(url):
|
259 |
download_from_url(url)
|
@@ -312,11 +312,11 @@ with gr.Blocks(theme="ParityError/Interstellar") as app:
|
|
312 |
dropbox = gr.File(label="Drop an audio here.",file_types=['.wav', '.mp3', '.ogg', '.flac', '.aac'], type="file")
|
313 |
dropbox.upload(fn=upload_file, inputs=[dropbox],outputs=[audio_picker])
|
314 |
with gr.TabItem("download audio acapella"):
|
315 |
-
|
316 |
-
|
317 |
outputs_audiq = gr.Textbox(label="audio outputs")
|
318 |
download_yt_button = gr.Button("download")
|
319 |
-
download_yt_button.click(fn=audio_downloader inputs=[
|
320 |
|
321 |
|
322 |
with gr.Row():
|
|
|
243 |
|
244 |
|
245 |
|
246 |
+
def download_from_url(url_yt, audioname):
|
247 |
ydl_opts = {
|
248 |
'format': 'bestaudio/best',
|
249 |
'postprocessors': [{
|
250 |
'key': 'FFmpegExtractAudio',
|
251 |
'preferredcodec': 'wav',
|
252 |
}],
|
253 |
+
"outtmpl": f'audios/{audioname}', # Format output filename
|
254 |
}
|
255 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
256 |
+
ydl.download([urlyt])
|
257 |
|
258 |
def audio_downloader(url):
|
259 |
download_from_url(url)
|
|
|
312 |
dropbox = gr.File(label="Drop an audio here.",file_types=['.wav', '.mp3', '.ogg', '.flac', '.aac'], type="file")
|
313 |
dropbox.upload(fn=upload_file, inputs=[dropbox],outputs=[audio_picker])
|
314 |
with gr.TabItem("download audio acapella"):
|
315 |
+
url_yt1 = gr.Textbox(label="YouTube url")
|
316 |
+
audio_name2 = gr.Textbox(label="audio name")
|
317 |
outputs_audiq = gr.Textbox(label="audio outputs")
|
318 |
download_yt_button = gr.Button("download")
|
319 |
+
download_yt_button.click(fn=audio_downloader inputs=[url_yt1, audio_name2,],outputs=[outputs_audiq])
|
320 |
|
321 |
|
322 |
with gr.Row():
|