theNeofr commited on
Commit
eb1c729
·
verified ·
1 Parent(s): 2ac2781

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -6
app.py CHANGED
@@ -2,6 +2,28 @@ import gradio as gr
2
  from separwator import *
3
 
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  with gr.Blocks(theme ="hev832/applio", title = "🎵 Audio Separator UI 🎵") as app:
6
  with gr.Row():
7
  gr.Markdown("<h1> 🎵 Audio Separator UI 🎵 </h1>")
@@ -570,12 +592,12 @@ with gr.Blocks(theme ="hev832/applio", title = "🎵 Audio Separator UI 🎵") a
570
  value = 0.1,
571
  interactive = True
572
  )
573
- with gr.Row():
574
- demucs_audio = gr.Audio(
575
- label = "Input audio",
576
- type = "filepath",
577
- interactive = True
578
- )
579
  with gr.Accordion("Separation by link", open = False):
580
  with gr.Row():
581
  demucs_link = gr.Textbox(
@@ -669,5 +691,12 @@ with gr.Blocks(theme ="hev832/applio", title = "🎵 Audio Separator UI 🎵") a
669
  """
670
  )
671
 
 
 
 
 
 
 
 
672
  app.queue()
673
  app.launch(share=True, debug=True)
 
2
  from separwator import *
3
 
4
 
5
+ def leaderboard(list_filter, list_limit):
6
+ try:
7
+ result = subprocess.run(
8
+ ["audio-separator", "-l", f"--list_filter={list_filter}", f"--list_limit={list_limit}"],
9
+ capture_output=True,
10
+ text=True,
11
+ )
12
+ if result.returncode != 0:
13
+ return f"Error: {result.stderr}"
14
+
15
+ return "<table border='1'>" + "".join(
16
+ f"<tr style='{'font-weight: bold; font-size: 1.2em;' if i == 0 else ''}'>" +
17
+ "".join(f"<td>{cell}</td>" for cell in re.split(r"\s{2,}", line.strip())) +
18
+ "</tr>"
19
+ for i, line in enumerate(re.findall(r"^(?!-+)(.+)$", result.stdout.strip(), re.MULTILINE))
20
+ ) + "</table>"
21
+
22
+ except Exception as e:
23
+ return f"Error: {e}"
24
+
25
+
26
+
27
  with gr.Blocks(theme ="hev832/applio", title = "🎵 Audio Separator UI 🎵") as app:
28
  with gr.Row():
29
  gr.Markdown("<h1> 🎵 Audio Separator UI 🎵 </h1>")
 
592
  value = 0.1,
593
  interactive = True
594
  )
595
+ with gr.Row():
596
+ demucs_audio = gr.Audio(
597
+ label = "Input audio",
598
+ type = "filepath",
599
+ interactive = True
600
+ )
601
  with gr.Accordion("Separation by link", open = False):
602
  with gr.Row():
603
  demucs_link = gr.Textbox(
 
691
  """
692
  )
693
 
694
+ with gr.Tab("Leaderboard"):
695
+ with gr.Row(equal_height=True):
696
+ list_filter = gr.Dropdown(value="vocals", choices=["vocals", "instrumental", "drums", "bass", "guitar", "piano", "other"], label="List filter", info="Filter and sort the model list by 'stem'")
697
+ list_limit = gr.Slider(minimum=1, maximum=10, step=1, value=5, label="List limit", info="Limit the number of models shown.")
698
+ list_button = gr.Button("Show list", variant="primary")
699
+ output_list = gr.HTML(label="Leaderboard")
700
+
701
  app.queue()
702
  app.launch(share=True, debug=True)