kamalOjas commited on
Commit
a11b2e8
·
1 Parent(s): 8fab349
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -27,19 +27,18 @@ def download_audio_as_mp3(url):
27
  return None, f"An error occurred: {e}"
28
 
29
 
30
- # Define the Gradio interface
31
  def audio_downloader(url):
32
  file_path, error_message = download_audio_as_mp3(url)
33
  if error_message:
34
- return error_message
35
  else:
36
- return file_path
37
 
38
  # Create a Gradio interface
39
  iface = gr.Interface(
40
  fn=audio_downloader,
41
- inputs=gr.Textbox(label="YouTube URL"),
42
- outputs=gr.File(label="Download MP3"),
43
  title="YouTube Audio Downloader",
44
  description="Enter a YouTube URL and download the audio as an MP3."
45
  )
 
27
  return None, f"An error occurred: {e}"
28
 
29
 
 
30
  def audio_downloader(url):
31
  file_path, error_message = download_audio_as_mp3(url)
32
  if error_message:
33
+ return None, error_message
34
  else:
35
+ return file_path, None
36
 
37
  # Create a Gradio interface
38
  iface = gr.Interface(
39
  fn=audio_downloader,
40
+ inputs=gr.Textbox(label="YouTube URL"),
41
+ outputs=[gr.File(label="Download MP3"), gr.Textbox(label="Error Message")],
42
  title="YouTube Audio Downloader",
43
  description="Enter a YouTube URL and download the audio as an MP3."
44
  )