Hev832 commited on
Commit
6157eff
·
verified ·
1 Parent(s): 8b8975f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +17 -3
main.py CHANGED
@@ -83,9 +83,23 @@ def raise_exception(error_msg, is_webui):
83
  with gr.Blocks(theme=gr.themes.Soft) as app:
84
  gr.HTML("<h1> youtube downloader </h1>")
85
 
86
- show_yt_link_button = gr.Button('Paste YouTube link/Path to local file instead')
87
- song_input_file.upload(process_file_upload, inputs=[song_input_file], outputs=[local_file, song_input])
88
 
 
 
89
 
90
- download_path = gr.Audio(label='download_path', show_share_button=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
 
83
  with gr.Blocks(theme=gr.themes.Soft) as app:
84
  gr.HTML("<h1> youtube downloader </h1>")
85
 
 
 
86
 
87
+ def download_from_url(url, audio_name):
88
+ ydl.download([url])
89
 
90
+ def youtube_to_wav(url, audio_name):
91
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
92
+ download_from_url(url, audio_name)
93
+
94
+ # Gradio interface
95
+ iface = gr.Interface(
96
+ fn=youtube_to_wav,
97
+ inputs=["text", "text"],
98
+ outputs="text",
99
+ live=True,
100
+ capture_session=True
101
+ )
102
+
103
+ # Launch Gradio interface
104
+ iface.launch()
105