Politrees commited on
Commit
831652c
·
verified ·
1 Parent(s): e703d09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -1
app.py CHANGED
@@ -3,6 +3,7 @@ import torch
3
  import shutil
4
  import logging
5
  import gradio as gr
 
6
 
7
  from PolUVR.separator import Separator
8
 
@@ -122,6 +123,46 @@ DEMUCS_MODELS = [
122
  'htdemucs_ft.yaml',
123
  ]
124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  def print_message(input_file, model_name):
126
  """Prints information about the audio separation process."""
127
  base_name = os.path.splitext(os.path.basename(input_file))[0]
@@ -486,7 +527,12 @@ with gr.Blocks(
486
  guitar_stem = gr.Textbox(value="NAME_(STEM)_MODEL", label="Guitar Stem", info="Output example: Music_(Guitar)_BS-Roformer-Viperx-1297", placeholder="NAME_(STEM)_MODEL")
487
  piano_stem = gr.Textbox(value="NAME_(STEM)_MODEL", label="Piano Stem", info="Output example: Music_(Piano)_BS-Roformer-Viperx-1297", placeholder="NAME_(STEM)_MODEL")
488
 
489
- with gr.TabItem("Credits"):
 
 
 
 
 
490
  gr.Markdown(
491
  """
492
  PolUVR created by **[Politrees](https://github.com/Bebra777228)**.
 
3
  import shutil
4
  import logging
5
  import gradio as gr
6
+ import pandas as pd
7
 
8
  from PolUVR.separator import Separator
9
 
 
123
  'htdemucs_ft.yaml',
124
  ]
125
 
126
+ def load_data(file_path):
127
+ df = pd.read_csv(file_path)
128
+ return df
129
+
130
+ def sort_data(architecture, purpose, sdr_metric):
131
+ df = load_data("models.csv")
132
+
133
+ if architecture != "All":
134
+ df = df[df['Architecture'] == architecture]
135
+ if purpose != "All":
136
+ df = df[df['Purpose'] == purpose]
137
+ if sdr_metric != "All":
138
+ df = df.sort_values(by=sdr_metric, ascending=False)
139
+
140
+ return df
141
+
142
+ def create_leaderboard_tab():
143
+ architectures = ["All", "Roformer", "MDXC", "MDX", "VR-ARCH", "DEMUCS", "Other"]
144
+ purposes = ["All", "VocInst", "DeEcho", "DeReverb", "DeNoise", "Karaoke", "Crowd", "Other"]
145
+ sdr_metrics = ["All", "Vocal SDR", "Instrumental SDR", "Drums SDR", "Bass SDR", "Guitar SDR", "Piano SDR", "Other SDR"]
146
+
147
+ with gr.Row():
148
+ architecture_dropdown = gr.Dropdown(choices=architectures, label="Architecture")
149
+ purpose_dropdown = gr.Dropdown(choices=purposes, label="Purpose")
150
+ sdr_metric_dropdown = gr.Dropdown(choices=sdr_metrics, label="SDR Metric")
151
+
152
+ with gr.Row():
153
+ sort_button = gr.Button("Sort Models", variant="primary")
154
+
155
+ with gr.Row():
156
+ leaderboard_output = gr.Dataframe(label="Leaderboard", interactive=False)
157
+
158
+ sort_button.click(
159
+ sort_data,
160
+ inputs=[architecture_dropdown, purpose_dropdown, sdr_metric_dropdown],
161
+ outputs=leaderboard_output
162
+ )
163
+
164
+ return leaderboard_output
165
+
166
  def print_message(input_file, model_name):
167
  """Prints information about the audio separation process."""
168
  base_name = os.path.splitext(os.path.basename(input_file))[0]
 
527
  guitar_stem = gr.Textbox(value="NAME_(STEM)_MODEL", label="Guitar Stem", info="Output example: Music_(Guitar)_BS-Roformer-Viperx-1297", placeholder="NAME_(STEM)_MODEL")
528
  piano_stem = gr.Textbox(value="NAME_(STEM)_MODEL", label="Piano Stem", info="Output example: Music_(Piano)_BS-Roformer-Viperx-1297", placeholder="NAME_(STEM)_MODEL")
529
 
530
+ with gr.Tab("Leaderboard"):
531
+ gr.Markdown("## Model Leaderboard")
532
+ gr.Markdown("Sort models by architecture, purpose, and SDR metrics.")
533
+ create_leaderboard_tab()
534
+
535
+ with gr.Tab("Credits"):
536
  gr.Markdown(
537
  """
538
  PolUVR created by **[Politrees](https://github.com/Bebra777228)**.