Spaces:
Sleeping
Sleeping
j-tobias
commited on
Commit
β’
e4732e1
1
Parent(s):
2ff44a9
added search bar + plot
Browse files- app.py +49 -2
- requirements.txt +1 -0
- utils_display.py +1 -1
app.py
CHANGED
@@ -6,6 +6,7 @@ from init import is_model_on_hub, upload_file, load_all_info_from_dataset_hub
|
|
6 |
from utils_display import AutoEvalColumn, fields, make_clickable_model, styled_error, styled_message
|
7 |
from datetime import datetime, timezone
|
8 |
from utils_display import make_best_bold
|
|
|
9 |
|
10 |
LAST_UPDATED = "Sep 11th 2024"
|
11 |
|
@@ -51,8 +52,10 @@ def request_model(model_text, chbcoco2017):
|
|
51 |
# ... (keep the existing request_model function as is)
|
52 |
pass
|
53 |
|
54 |
-
def update_table(column_selection):
|
55 |
original_df = pd.read_csv("data.csv")
|
|
|
|
|
56 |
|
57 |
if column_selection == "All Columns":
|
58 |
new_df = original_df
|
@@ -74,6 +77,43 @@ def update_table(column_selection):
|
|
74 |
|
75 |
return new_df
|
76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
with gr.Blocks() as demo:
|
78 |
gr.HTML(BANNER, elem_id="banner")
|
79 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
@@ -94,8 +134,11 @@ with gr.Blocks() as demo:
|
|
94 |
label="Categories",
|
95 |
value="All Columns"
|
96 |
)
|
|
|
|
|
97 |
|
98 |
-
column_radio.change(update_table, inputs=[column_radio], outputs=[leaderboard_table])
|
|
|
99 |
|
100 |
with gr.TabItem("π Metrics", elem_id="od-benchmark-tab-table", id=1):
|
101 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
@@ -114,6 +157,10 @@ with gr.Blocks() as demo:
|
|
114 |
btn_submitt.click(request_model,
|
115 |
[model_name_textbox, chb_coco2017],
|
116 |
mdw_submission_result)
|
|
|
|
|
|
|
|
|
117 |
|
118 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
119 |
|
|
|
6 |
from utils_display import AutoEvalColumn, fields, make_clickable_model, styled_error, styled_message
|
7 |
from datetime import datetime, timezone
|
8 |
from utils_display import make_best_bold
|
9 |
+
import plotly.graph_objects as go
|
10 |
|
11 |
LAST_UPDATED = "Sep 11th 2024"
|
12 |
|
|
|
52 |
# ... (keep the existing request_model function as is)
|
53 |
pass
|
54 |
|
55 |
+
def update_table(column_selection, search:str):
|
56 |
original_df = pd.read_csv("data.csv")
|
57 |
+
|
58 |
+
original_df = original_df[original_df['model'].str.contains(search, case=False, na=False)]
|
59 |
|
60 |
if column_selection == "All Columns":
|
61 |
new_df = original_df
|
|
|
77 |
|
78 |
return new_df
|
79 |
|
80 |
+
def generate_plot():
|
81 |
+
df = pd.read_csv("data.csv")
|
82 |
+
fig = go.Figure()
|
83 |
+
|
84 |
+
fig.add_trace(go.Scatter(
|
85 |
+
x=df['Average WER β¬οΈ '],
|
86 |
+
y=df['RTFx β¬οΈ '],
|
87 |
+
mode='markers',
|
88 |
+
text=df['model'],
|
89 |
+
hovertemplate=
|
90 |
+
'<b>%{text}</b><br>' +
|
91 |
+
'Average WER: %{x:.2f}<br>' +
|
92 |
+
'RTFx: %{y:.2f}<br>' +
|
93 |
+
'<extra></extra>',
|
94 |
+
marker=dict(
|
95 |
+
size=10,
|
96 |
+
# color=df['Average WER β¬οΈ '],
|
97 |
+
colorscale='Viridis',
|
98 |
+
# colorbar=dict(title='Average WER'),
|
99 |
+
# showscale=True
|
100 |
+
)
|
101 |
+
))
|
102 |
+
|
103 |
+
# Update the layout
|
104 |
+
fig.update_layout(
|
105 |
+
title='ASR Model Performance: Average WER vs RTFx',
|
106 |
+
xaxis_title='Average WER (lower is better)',
|
107 |
+
yaxis_title='RTFx (higher is better)',
|
108 |
+
#yaxis_type='log',
|
109 |
+
hovermode='closest'
|
110 |
+
)
|
111 |
+
|
112 |
+
# Show the plot
|
113 |
+
return fig
|
114 |
+
|
115 |
+
|
116 |
+
|
117 |
with gr.Blocks() as demo:
|
118 |
gr.HTML(BANNER, elem_id="banner")
|
119 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
|
|
134 |
label="Categories",
|
135 |
value="All Columns"
|
136 |
)
|
137 |
+
|
138 |
+
search_bar = gr.Textbox(label="Search models", placeholder="Enter model name...")
|
139 |
|
140 |
+
column_radio.change(update_table, inputs=[column_radio, search_bar], outputs=[leaderboard_table])
|
141 |
+
search_bar.submit(update_table, inputs=[column_radio, search_bar], outputs=[leaderboard_table])
|
142 |
|
143 |
with gr.TabItem("π Metrics", elem_id="od-benchmark-tab-table", id=1):
|
144 |
gr.Markdown(METRICS_TAB_TEXT, elem_classes="markdown-text")
|
|
|
157 |
btn_submitt.click(request_model,
|
158 |
[model_name_textbox, chb_coco2017],
|
159 |
mdw_submission_result)
|
160 |
+
|
161 |
+
with gr.TabItem("π Plots", elem_id="od-benchmark-tab-table", id=3):
|
162 |
+
|
163 |
+
plot = gr.Plot(generate_plot)
|
164 |
|
165 |
gr.Markdown(f"Last updated on **{LAST_UPDATED}**", elem_classes="markdown-text")
|
166 |
|
requirements.txt
CHANGED
@@ -59,3 +59,4 @@ tzdata==2023.3
|
|
59 |
urllib3==2.0.4
|
60 |
xxhash==3.2.0
|
61 |
yarl==1.9.2
|
|
|
|
59 |
urllib3==2.0.4
|
60 |
xxhash==3.2.0
|
61 |
yarl==1.9.2
|
62 |
+
plotly==5.6.0
|
utils_display.py
CHANGED
@@ -43,6 +43,6 @@ def make_best_bold(column, column_name):
|
|
43 |
best_value = column.max()
|
44 |
else:
|
45 |
best_value = column.min()
|
46 |
-
return column.apply(lambda x: f'#### <span style="color:
|
47 |
|
48 |
|
|
|
43 |
best_value = column.max()
|
44 |
else:
|
45 |
best_value = column.min()
|
46 |
+
return column.apply(lambda x: f'#### <span style="color: blue;">{float(x):.2f}</span>' if x == best_value else f"{x:.2f}")
|
47 |
|
48 |
|