Spaces:
Running
Running
Jellyfish042
commited on
Commit
Β·
9210847
1
Parent(s):
85d9c00
add RangeSlider
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ import numpy as np
|
|
12 |
from huggingface_hub import HfApi
|
13 |
from huggingface_hub.hf_api import HTTPError
|
14 |
from huggingface_hub.utils._errors import GatedRepoError
|
|
|
15 |
|
16 |
|
17 |
load_dotenv()
|
@@ -143,6 +144,7 @@ def update_table(period: str,
|
|
143 |
metric: str,
|
144 |
visible_columns: list,
|
145 |
color_columns: list,
|
|
|
146 |
sort_by: str = 'Average (The lower the better)',
|
147 |
ascending: bool = True):
|
148 |
target_data = all_data[period]
|
@@ -153,6 +155,9 @@ def update_table(period: str,
|
|
153 |
combined_data = pd.concat([target_data[model][target_metric] for model in target_model_size], axis=0)
|
154 |
combined_data['Name'] = combined_data['Name'].apply(lambda x: x.replace('.pth', ''))
|
155 |
|
|
|
|
|
|
|
156 |
combined_data.reset_index(drop=True, inplace=True)
|
157 |
|
158 |
if 'Average (The lower the better)' in combined_data.columns:
|
@@ -360,7 +365,8 @@ initial_models = model_size_list
|
|
360 |
initial_metric = metric_list[0]
|
361 |
initial_columns = get_unique_column_names(all_data)
|
362 |
initial_colors = ['Average']
|
363 |
-
|
|
|
364 |
|
365 |
css = '''
|
366 |
.gradio-container {
|
@@ -387,7 +393,8 @@ with gr.Blocks(css=css) as demo:
|
|
387 |
with gr.Row():
|
388 |
with gr.Column():
|
389 |
period_selector = gr.Dropdown(label="Period", choices=time_list, value=last_period)
|
390 |
-
model_selector = gr.CheckboxGroup(label="Model", choices=model_size_list, value=model_size_list)
|
|
|
391 |
metric_selector = gr.Dropdown(label="Metric", choices=metric_list, value=metric_list[0])
|
392 |
with gr.Column():
|
393 |
color_selector = gr.CheckboxGroup(label="Colored Columns",
|
@@ -403,20 +410,23 @@ with gr.Blocks(css=css) as demo:
|
|
403 |
)
|
404 |
|
405 |
period_selector.change(update_table,
|
406 |
-
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector],
|
407 |
outputs=table)
|
408 |
model_selector.change(update_table,
|
409 |
-
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector],
|
410 |
outputs=table)
|
411 |
metric_selector.change(update_table,
|
412 |
-
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector],
|
413 |
outputs=table)
|
414 |
colfilter.change(update_table,
|
415 |
-
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector],
|
416 |
outputs=table)
|
417 |
color_selector.change(update_table,
|
418 |
-
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector],
|
419 |
outputs=table)
|
|
|
|
|
|
|
420 |
|
421 |
with gr.Tab("π MultiLang"):
|
422 |
gr.Markdown("## Coming soon...")
|
|
|
12 |
from huggingface_hub import HfApi
|
13 |
from huggingface_hub.hf_api import HTTPError
|
14 |
from huggingface_hub.utils._errors import GatedRepoError
|
15 |
+
from gradio_rangeslider import RangeSlider
|
16 |
|
17 |
|
18 |
load_dotenv()
|
|
|
144 |
metric: str,
|
145 |
visible_columns: list,
|
146 |
color_columns: list,
|
147 |
+
size_range: list,
|
148 |
sort_by: str = 'Average (The lower the better)',
|
149 |
ascending: bool = True):
|
150 |
target_data = all_data[period]
|
|
|
155 |
combined_data = pd.concat([target_data[model][target_metric] for model in target_model_size], axis=0)
|
156 |
combined_data['Name'] = combined_data['Name'].apply(lambda x: x.replace('.pth', ''))
|
157 |
|
158 |
+
# Filter models based on the size range
|
159 |
+
combined_data = combined_data[combined_data['Parameters Count (B)'].between(size_range[0], size_range[1])]
|
160 |
+
|
161 |
combined_data.reset_index(drop=True, inplace=True)
|
162 |
|
163 |
if 'Average (The lower the better)' in combined_data.columns:
|
|
|
365 |
initial_metric = metric_list[0]
|
366 |
initial_columns = get_unique_column_names(all_data)
|
367 |
initial_colors = ['Average']
|
368 |
+
initial_size_range = [0, 15]
|
369 |
+
initial_data = update_table(initial_period, initial_models, initial_metric, initial_columns, initial_colors, initial_size_range)
|
370 |
|
371 |
css = '''
|
372 |
.gradio-container {
|
|
|
393 |
with gr.Row():
|
394 |
with gr.Column():
|
395 |
period_selector = gr.Dropdown(label="Period", choices=time_list, value=last_period)
|
396 |
+
model_selector = gr.CheckboxGroup(label="Model Size", choices=model_size_list, value=model_size_list)
|
397 |
+
size_range_slider = RangeSlider(minimum=0, maximum=15, value=[0, 15], step=0.1, label="Model Size Range")
|
398 |
metric_selector = gr.Dropdown(label="Metric", choices=metric_list, value=metric_list[0])
|
399 |
with gr.Column():
|
400 |
color_selector = gr.CheckboxGroup(label="Colored Columns",
|
|
|
410 |
)
|
411 |
|
412 |
period_selector.change(update_table,
|
413 |
+
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector, size_range_slider],
|
414 |
outputs=table)
|
415 |
model_selector.change(update_table,
|
416 |
+
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector, size_range_slider],
|
417 |
outputs=table)
|
418 |
metric_selector.change(update_table,
|
419 |
+
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector, size_range_slider],
|
420 |
outputs=table)
|
421 |
colfilter.change(update_table,
|
422 |
+
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector, size_range_slider],
|
423 |
outputs=table)
|
424 |
color_selector.change(update_table,
|
425 |
+
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector, size_range_slider],
|
426 |
outputs=table)
|
427 |
+
size_range_slider.change(update_table,
|
428 |
+
inputs=[period_selector, model_selector, metric_selector, colfilter, color_selector, size_range_slider],
|
429 |
+
outputs=table)
|
430 |
|
431 |
with gr.Tab("π MultiLang"):
|
432 |
gr.Markdown("## Coming soon...")
|