Blane187 commited on
Commit
e5d945e
·
verified ·
1 Parent(s): b48ae3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import yt_dlp
2
  import gradio as gr
3
 
4
- def download_youtube_wav(url, custom_name, custom_directory):
5
  ydl_opts = {
6
  'format': 'bestaudio/best',
7
  'postprocessors': [{
@@ -9,21 +9,20 @@ def download_youtube_wav(url, custom_name, custom_directory):
9
  'preferredcodec': 'wav',
10
  'preferredquality': '192',
11
  }],
12
- 'outtmpl': f'{custom_directory}/{custom_name}.%(ext)s',
13
  }
14
 
15
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
16
  ydl.download([url])
17
-
18
- return f'Download complete! File saved as {custom_name}.wav in {custom_directory}'
19
 
20
  iface = gr.Interface(
21
  fn=download_youtube_wav,
22
- inputs=['text', 'text', 'text'],
23
- outputs='Audio',
24
  title='YouTube WAV Downloader',
25
- description='Enter the YouTube URL, custom filename, and directory to download the video as a WAV file.'
26
  )
27
 
28
- if __name__ == "__main__":
29
- iface.launch()
 
1
  import yt_dlp
2
  import gradio as gr
3
 
4
+ def download_youtube_wav(url, custom_name):
5
  ydl_opts = {
6
  'format': 'bestaudio/best',
7
  'postprocessors': [{
 
9
  'preferredcodec': 'wav',
10
  'preferredquality': '192',
11
  }],
12
+ 'outtmpl': f'{custom_name}.%(ext)s',
13
  }
14
 
15
  with yt_dlp.YoutubeDL(ydl_opts) as ydl:
16
  ydl.download([url])
17
+
18
+ return f'Download complete! File saved as: {custom_name}.wav'
19
 
20
  iface = gr.Interface(
21
  fn=download_youtube_wav,
22
+ inputs=['text', 'text'],
23
+ outputs=gr.Audio,
24
  title='YouTube WAV Downloader',
25
+ description='Enter the YouTube URL and a custom name for your .wav file.'
26
  )
27
 
28
+ iface.launch()