Spaces:
AIR-Bench
/
Running on CPU Upgrade

nan commited on
Commit
fff686a
1 Parent(s): ea7f641

feat: add toggle checkbox for qa

Browse files
Files changed (2) hide show
  1. app.py +20 -3
  2. src/utils.py +10 -5
app.py CHANGED
@@ -11,7 +11,7 @@ from src.about import (
11
  from src.benchmarks import DOMAIN_COLS_QA, LANG_COLS_QA, DOMAIN_COLS_LONG_DOC, LANG_COLS_LONG_DOC, METRIC_LIST, \
12
  DEFAULT_METRIC
13
  from src.display.css_html_js import custom_css
14
- from src.display.utils import COL_NAME_IS_ANONYMOUS
15
  from src.envs import API, EVAL_RESULTS_PATH, REPO_ID, RESULTS_REPO, TOKEN
16
  from src.read_evals import get_raw_eval_results, get_leaderboard_df
17
  from src.utils import update_table, update_metric, update_table_long_doc, upload_file, get_default_cols, submit_results
@@ -45,6 +45,7 @@ leaderboard_df_qa = original_df_qa.copy()
45
  shown_columns_qa, types_qa = get_default_cols(
46
  'qa', leaderboard_df_qa.columns, add_fix_cols=True)
47
  leaderboard_df_qa = leaderboard_df_qa[~leaderboard_df_qa[COL_NAME_IS_ANONYMOUS]][shown_columns_qa]
 
48
 
49
  leaderboard_df_long_doc = original_df_long_doc.copy()
50
  shown_columns_long_doc, types_long_doc = get_default_cols(
@@ -80,9 +81,10 @@ def update_table_without_ranking(
80
  langs,
81
  reranking_query,
82
  query,
83
- show_anonymous
 
84
  ):
85
- return update_table(hidden_df, domains, langs, reranking_query, query, show_anonymous, reset_ranking=False)
86
 
87
 
88
  def update_table_without_ranking_long_doc(
@@ -193,6 +195,20 @@ with demo:
193
  leaderboard_table,
194
  )
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  selected_rerankings.change(
197
  update_table_without_ranking,
198
  [
@@ -202,6 +218,7 @@ with demo:
202
  selected_rerankings,
203
  search_bar,
204
  show_anonymous,
 
205
  ],
206
  leaderboard_table,
207
  )
 
11
  from src.benchmarks import DOMAIN_COLS_QA, LANG_COLS_QA, DOMAIN_COLS_LONG_DOC, LANG_COLS_LONG_DOC, METRIC_LIST, \
12
  DEFAULT_METRIC
13
  from src.display.css_html_js import custom_css
14
+ from src.display.utils import COL_NAME_IS_ANONYMOUS, COL_NAME_REVISION, COL_NAME_TIMESTAMP
15
  from src.envs import API, EVAL_RESULTS_PATH, REPO_ID, RESULTS_REPO, TOKEN
16
  from src.read_evals import get_raw_eval_results, get_leaderboard_df
17
  from src.utils import update_table, update_metric, update_table_long_doc, upload_file, get_default_cols, submit_results
 
45
  shown_columns_qa, types_qa = get_default_cols(
46
  'qa', leaderboard_df_qa.columns, add_fix_cols=True)
47
  leaderboard_df_qa = leaderboard_df_qa[~leaderboard_df_qa[COL_NAME_IS_ANONYMOUS]][shown_columns_qa]
48
+ leaderboard_df_qa.drop([COL_NAME_REVISION, COL_NAME_TIMESTAMP], axis=1, inplace=True)
49
 
50
  leaderboard_df_long_doc = original_df_long_doc.copy()
51
  shown_columns_long_doc, types_long_doc = get_default_cols(
 
81
  langs,
82
  reranking_query,
83
  query,
84
+ show_anonymous,
85
+ show_revision_and_timestamp,
86
  ):
87
+ return update_table(hidden_df, domains, langs, reranking_query, query, show_anonymous, reset_ranking=False, show_revision_and_timestamp=show_revision_and_timestamp)
88
 
89
 
90
  def update_table_without_ranking_long_doc(
 
195
  leaderboard_table,
196
  )
197
 
198
+ show_revision_and_timestamp.change(
199
+ update_table_without_ranking,
200
+ [
201
+ hidden_leaderboard_table_for_search,
202
+ selected_domains,
203
+ selected_langs,
204
+ selected_rerankings,
205
+ search_bar,
206
+ show_anonymous,
207
+ show_revision_and_timestamp
208
+ ],
209
+ leaderboard_table
210
+ )
211
+
212
  selected_rerankings.change(
213
  update_table_without_ranking,
214
  [
 
218
  selected_rerankings,
219
  search_bar,
220
  show_anonymous,
221
+ show_revision_and_timestamp
222
  ],
223
  leaderboard_table,
224
  )
src/utils.py CHANGED
@@ -9,7 +9,7 @@ import pandas as pd
9
  from src.benchmarks import BENCHMARK_COLS_QA, BENCHMARK_COLS_LONG_DOC, BenchmarksQA, BenchmarksLongDoc
10
  from src.display.formatting import styled_message, styled_error
11
  from src.display.utils import COLS_QA, TYPES_QA, COLS_LONG_DOC, TYPES_LONG_DOC, COL_NAME_RANK, COL_NAME_AVG, \
12
- COL_NAME_RERANKING_MODEL, COL_NAME_RETRIEVAL_MODEL, COL_NAME_IS_ANONYMOUS, get_default_auto_eval_column_dict
13
  from src.envs import API, SEARCH_RESULTS_REPO
14
  from src.read_evals import FullEvalResult, get_leaderboard_df, calculate_mean
15
 
@@ -130,14 +130,18 @@ def _update_table(
130
  reranking_query: list,
131
  query: str,
132
  show_anonymous: bool,
133
- reset_ranking: bool = True
 
134
  ):
135
  filtered_df = hidden_df.copy()
136
  if not show_anonymous:
137
  filtered_df = filtered_df[~filtered_df[COL_NAME_IS_ANONYMOUS]]
138
  filtered_df = filter_models(filtered_df, reranking_query)
139
  filtered_df = filter_queries(query, filtered_df)
140
- return select_columns(filtered_df, domains, langs, task, reset_ranking)
 
 
 
141
 
142
 
143
  def update_table(
@@ -147,10 +151,11 @@ def update_table(
147
  reranking_query: list,
148
  query: str,
149
  show_anonymous: bool,
150
- reset_ranking: bool = True
 
151
  ):
152
  return _update_table(
153
- "qa", hidden_df, domains, langs, reranking_query, query, show_anonymous, reset_ranking)
154
 
155
 
156
  def update_table_long_doc(
 
9
  from src.benchmarks import BENCHMARK_COLS_QA, BENCHMARK_COLS_LONG_DOC, BenchmarksQA, BenchmarksLongDoc
10
  from src.display.formatting import styled_message, styled_error
11
  from src.display.utils import COLS_QA, TYPES_QA, COLS_LONG_DOC, TYPES_LONG_DOC, COL_NAME_RANK, COL_NAME_AVG, \
12
+ COL_NAME_RERANKING_MODEL, COL_NAME_RETRIEVAL_MODEL, COL_NAME_IS_ANONYMOUS, COL_NAME_TIMESTAMP, COL_NAME_REVISION, get_default_auto_eval_column_dict
13
  from src.envs import API, SEARCH_RESULTS_REPO
14
  from src.read_evals import FullEvalResult, get_leaderboard_df, calculate_mean
15
 
 
130
  reranking_query: list,
131
  query: str,
132
  show_anonymous: bool,
133
+ reset_ranking: bool = True,
134
+ show_revision_and_timestamp: bool = False
135
  ):
136
  filtered_df = hidden_df.copy()
137
  if not show_anonymous:
138
  filtered_df = filtered_df[~filtered_df[COL_NAME_IS_ANONYMOUS]]
139
  filtered_df = filter_models(filtered_df, reranking_query)
140
  filtered_df = filter_queries(query, filtered_df)
141
+ filtered_df = select_columns(filtered_df, domains, langs, task, reset_ranking)
142
+ if not show_revision_and_timestamp:
143
+ filtered_df.drop([COL_NAME_REVISION, COL_NAME_TIMESTAMP], axis=1, inplace=True)
144
+ return filtered_df
145
 
146
 
147
  def update_table(
 
151
  reranking_query: list,
152
  query: str,
153
  show_anonymous: bool,
154
+ reset_ranking: bool = True,
155
+ show_revision_and_timestamp: bool = False
156
  ):
157
  return _update_table(
158
+ "qa", hidden_df, domains, langs, reranking_query, query, show_anonymous, reset_ranking, show_revision_and_timestamp)
159
 
160
 
161
  def update_table_long_doc(