ASesYusuf1 commited on
Commit
b956722
Β·
verified Β·
1 Parent(s): 57b3cc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -528,6 +528,10 @@ def update_ensemble_models(category):
528
  logger.debug(f"Updating ensemble models for category {category}: {choices}")
529
  return gr.update(choices=choices, value=[])
530
 
 
 
 
 
531
  def create_interface():
532
  with gr.Blocks(title="🎡 SESA Fast Separation 🎡", css=CSS, elem_id="app-container") as app:
533
  gr.Markdown("<h1 class='header-text'>🎡 SESA Fast Separation 🎡</h1>")
@@ -554,6 +558,7 @@ def create_interface():
554
  url_ro = gr.Textbox(label="πŸ”— Or Paste URL", placeholder="YouTube or audio URL", interactive=True)
555
  cookies_ro = gr.File(label="πŸͺ Cookies File", file_types=[".txt"], interactive=True)
556
  download_roformer = gr.Button("⬇️ Download", variant="secondary")
 
557
  roformer_exclude_stems = gr.Textbox(label="🚫 Exclude Stems", placeholder="e.g., vocals, drums (comma-separated)", interactive=True)
558
  with gr.Row():
559
  roformer_category = gr.Dropdown(label="πŸ“š Category", choices=list(ROFORMER_MODELS.keys()), value="General Purpose", interactive=True)
@@ -578,6 +583,7 @@ def create_interface():
578
  url_ensemble = gr.Textbox(label="πŸ”— Or Paste URL", placeholder="YouTube or audio URL", interactive=True)
579
  cookies_ensemble = gr.File(label="πŸͺ Cookies File", file_types=[".txt"], interactive=True)
580
  download_ensemble = gr.Button("⬇️ Download", variant="secondary")
 
581
  ensemble_exclude_stems = gr.Textbox(label="🚫 Exclude Stems", placeholder="e.g., vocals, drums (comma-separated)", interactive=True)
582
  with gr.Row():
583
  ensemble_category = gr.Dropdown(label="πŸ“š Category", choices=list(ROFORMER_MODELS.keys()), value="Instrumentals", interactive=True)
@@ -597,9 +603,9 @@ def create_interface():
597
  # Event Handlers
598
  roformer_category.change(update_roformer_models, inputs=[roformer_category], outputs=[roformer_model])
599
  download_roformer.click(
600
- fn=download_audio,
601
  inputs=[url_ro, cookies_ro],
602
- outputs=[roformer_audio] # Now expects (sample_rate, data)
603
  )
604
  roformer_button.click(
605
  fn=roformer_separator,
@@ -612,9 +618,9 @@ def create_interface():
612
  )
613
  ensemble_category.change(update_ensemble_models, inputs=[ensemble_category], outputs=[ensemble_models])
614
  download_ensemble.click(
615
- fn=download_audio,
616
  inputs=[url_ensemble, cookies_ensemble],
617
- outputs=[ensemble_audio] # Now expects (sample_rate, data)
618
  )
619
  ensemble_button.click(
620
  fn=auto_ensemble_process,
 
528
  logger.debug(f"Updating ensemble models for category {category}: {choices}")
529
  return gr.update(choices=choices, value=[])
530
 
531
+ def download_audio_wrapper(url, cookie_file):
532
+ file_path, status, audio_data = download_audio(url, cookie_file)
533
+ return audio_data, status # Return audio_data for gr.Audio, status for gr.Textbox
534
+
535
  def create_interface():
536
  with gr.Blocks(title="🎡 SESA Fast Separation 🎡", css=CSS, elem_id="app-container") as app:
537
  gr.Markdown("<h1 class='header-text'>🎡 SESA Fast Separation 🎡</h1>")
 
558
  url_ro = gr.Textbox(label="πŸ”— Or Paste URL", placeholder="YouTube or audio URL", interactive=True)
559
  cookies_ro = gr.File(label="πŸͺ Cookies File", file_types=[".txt"], interactive=True)
560
  download_roformer = gr.Button("⬇️ Download", variant="secondary")
561
+ roformer_download_status = gr.Textbox(label="πŸ“’ Download Status", interactive=False) # Added status output
562
  roformer_exclude_stems = gr.Textbox(label="🚫 Exclude Stems", placeholder="e.g., vocals, drums (comma-separated)", interactive=True)
563
  with gr.Row():
564
  roformer_category = gr.Dropdown(label="πŸ“š Category", choices=list(ROFORMER_MODELS.keys()), value="General Purpose", interactive=True)
 
583
  url_ensemble = gr.Textbox(label="πŸ”— Or Paste URL", placeholder="YouTube or audio URL", interactive=True)
584
  cookies_ensemble = gr.File(label="πŸͺ Cookies File", file_types=[".txt"], interactive=True)
585
  download_ensemble = gr.Button("⬇️ Download", variant="secondary")
586
+ ensemble_download_status = gr.Textbox(label="πŸ“’ Download Status", interactive=False) # Added status output
587
  ensemble_exclude_stems = gr.Textbox(label="🚫 Exclude Stems", placeholder="e.g., vocals, drums (comma-separated)", interactive=True)
588
  with gr.Row():
589
  ensemble_category = gr.Dropdown(label="πŸ“š Category", choices=list(ROFORMER_MODELS.keys()), value="Instrumentals", interactive=True)
 
603
  # Event Handlers
604
  roformer_category.change(update_roformer_models, inputs=[roformer_category], outputs=[roformer_model])
605
  download_roformer.click(
606
+ fn=download_audio_wrapper,
607
  inputs=[url_ro, cookies_ro],
608
+ outputs=[roformer_audio, roformer_download_status] # Updated to use wrapper and output status
609
  )
610
  roformer_button.click(
611
  fn=roformer_separator,
 
618
  )
619
  ensemble_category.change(update_ensemble_models, inputs=[ensemble_category], outputs=[ensemble_models])
620
  download_ensemble.click(
621
+ fn=download_audio_wrapper,
622
  inputs=[url_ensemble, cookies_ensemble],
623
+ outputs=[ensemble_audio, ensemble_download_status] # Updated to use wrapper and output status
624
  )
625
  ensemble_button.click(
626
  fn=auto_ensemble_process,