Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
feat: add listeners for columns
Browse files
app.py
CHANGED
@@ -87,7 +87,7 @@ with demo:
|
|
87 |
interactive=True
|
88 |
)
|
89 |
# select reranking models
|
90 |
-
reranking_models = list(frozenset([eval_result.
|
91 |
with gr.Row():
|
92 |
selected_rerankings = gr.CheckboxGroup(
|
93 |
choices=reranking_models,
|
@@ -104,26 +104,24 @@ with demo:
|
|
104 |
interactive=True,
|
105 |
elem_id="metric-select",
|
106 |
)
|
107 |
-
# update shown_columns when selected_langs and selected_domains are changed
|
108 |
-
shown_columns = leaderboard_df.columns
|
109 |
|
110 |
# reload the leaderboard_df and raw_data when selected_metric is changed
|
111 |
leaderboard_table = gr.components.Dataframe(
|
112 |
value=leaderboard_df,
|
113 |
# headers=shown_columns,
|
114 |
-
datatype=TYPES,
|
115 |
elem_id="leaderboard-table",
|
116 |
interactive=False,
|
117 |
visible=True,
|
118 |
)
|
119 |
|
120 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
# search_bar.submit(
|
128 |
# update_table,
|
129 |
# [
|
@@ -134,18 +132,19 @@ with demo:
|
|
134 |
# ],
|
135 |
# leaderboard_table,
|
136 |
# )
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
|
|
149 |
|
150 |
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
151 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
|
|
87 |
interactive=True
|
88 |
)
|
89 |
# select reranking models
|
90 |
+
reranking_models = list(frozenset([eval_result.reranking_model for eval_result in raw_data_qa]))
|
91 |
with gr.Row():
|
92 |
selected_rerankings = gr.CheckboxGroup(
|
93 |
choices=reranking_models,
|
|
|
104 |
interactive=True,
|
105 |
elem_id="metric-select",
|
106 |
)
|
|
|
|
|
107 |
|
108 |
# reload the leaderboard_df and raw_data when selected_metric is changed
|
109 |
leaderboard_table = gr.components.Dataframe(
|
110 |
value=leaderboard_df,
|
111 |
# headers=shown_columns,
|
112 |
+
# datatype=TYPES,
|
113 |
elem_id="leaderboard-table",
|
114 |
interactive=False,
|
115 |
visible=True,
|
116 |
)
|
117 |
|
118 |
# Dummy leaderboard for handling the case when the user uses backspace key
|
119 |
+
hidden_leaderboard_table_for_search = gr.components.Dataframe(
|
120 |
+
value=original_df_qa,
|
121 |
+
# headers=COLS,
|
122 |
+
# datatype=TYPES,
|
123 |
+
visible=False,
|
124 |
+
)
|
125 |
# search_bar.submit(
|
126 |
# update_table,
|
127 |
# [
|
|
|
132 |
# ],
|
133 |
# leaderboard_table,
|
134 |
# )
|
135 |
+
for selector in [selected_domains, selected_langs]:
|
136 |
+
selector.change(
|
137 |
+
update_table,
|
138 |
+
[
|
139 |
+
hidden_leaderboard_table_for_search,
|
140 |
+
selected_domains,
|
141 |
+
selected_langs,
|
142 |
+
selected_rerankings,
|
143 |
+
search_bar,
|
144 |
+
],
|
145 |
+
leaderboard_table,
|
146 |
+
queue=True,
|
147 |
+
)
|
148 |
|
149 |
with gr.TabItem("📝 About", elem_id="llm-benchmark-tab-table", id=2):
|
150 |
gr.Markdown(LLM_BENCHMARKS_TEXT, elem_classes="markdown-text")
|
utils.py
CHANGED
@@ -60,11 +60,12 @@ def select_columns(df: pd.DataFrame, domain_query: list, language_query: list) -
|
|
60 |
|
61 |
def update_table(
|
62 |
hidden_df: pd.DataFrame,
|
63 |
-
|
|
|
64 |
reranking_query: list,
|
65 |
query: str,
|
66 |
):
|
67 |
filtered_df = filter_models(hidden_df, reranking_query)
|
68 |
filtered_df = filter_queries(query, filtered_df)
|
69 |
-
df = select_columns(filtered_df,
|
70 |
-
return df
|
|
|
60 |
|
61 |
def update_table(
|
62 |
hidden_df: pd.DataFrame,
|
63 |
+
domains: list,
|
64 |
+
langs: list,
|
65 |
reranking_query: list,
|
66 |
query: str,
|
67 |
):
|
68 |
filtered_df = filter_models(hidden_df, reranking_query)
|
69 |
filtered_df = filter_queries(query, filtered_df)
|
70 |
+
df = select_columns(filtered_df, domains, langs)
|
71 |
+
return df
|