hysts HF staff commited on
Commit
0255312
1 Parent(s): 5d61ad7

Delete hidden_leaderboard

Browse files
Files changed (1) hide show
  1. app.py +7 -18
app.py CHANGED
@@ -190,7 +190,6 @@ def select_columns(df: pd.DataFrame, columns: list) -> pd.DataFrame:
190
 
191
 
192
  def update_table(
193
- hidden_df: pd.DataFrame,
194
  type_query: list,
195
  precision_query: str,
196
  size_query: list,
@@ -205,10 +204,9 @@ def update_table(
205
  print(
206
  f"Update table called with: type_query={type_query}, precision_query={precision_query}, size_query={size_query}"
207
  )
208
- print(f"hidden_df shape before filtering: {hidden_df.shape}")
209
 
210
  filtered_df = filter_models(
211
- hidden_df,
212
  type_query,
213
  size_query,
214
  precision_query,
@@ -306,8 +304,8 @@ def toggle_all_categories(action: str) -> list[gr.CheckboxGroup]:
306
  return results
307
 
308
 
309
- def plot_size_vs_score(df_filtered: pd.DataFrame, df_original: pd.DataFrame) -> go.Figure:
310
- df = df_original[df_original[AutoEvalColumn.row_id.name].isin(df_filtered[AutoEvalColumn.row_id.name])]
311
  df = df[df["#Params (B)"] > 0]
312
  df = df[["model_name_for_query", "#Params (B)", "AVG", "Few-shot"]]
313
  df["AVG"] = df["AVG"].astype(float)
@@ -333,8 +331,8 @@ TASK_AVG_NAME_MAP = {
333
  }
334
 
335
 
336
- def plot_average_scores(df_filtered: pd.DataFrame, df_original: pd.DataFrame) -> go.Figure:
337
- df = df_original[df_original[AutoEvalColumn.row_id.name].isin(df_filtered[AutoEvalColumn.row_id.name])]
338
  df = df[["model_name_for_query", "Few-shot"] + list(TASK_AVG_NAME_MAP.keys())]
339
  df = df.rename(columns={"model_name_for_query": "Model", "Few-shot": "n-shot"})
340
  df = df.rename(columns=TASK_AVG_NAME_MAP)
@@ -497,14 +495,6 @@ with gr.Blocks() as demo_leaderboard:
497
  graph_size_vs_score = gr.Plot(label="Model size vs. Average score")
498
  graph_average_scores = gr.Plot(label="Model Performance across Task Categories")
499
 
500
- # Dummy leaderboard for handling the case when the user uses backspace key
501
- hidden_leaderboard_table_for_search = gr.Dataframe(
502
- value=ORIGINAL_DF[COLS],
503
- headers=COLS,
504
- datatype=TYPES,
505
- visible=False,
506
- )
507
-
508
  # Define a hidden component that will trigger a reload only if a query parameter has been set
509
  hidden_search_bar = gr.Textbox(value="", visible=False)
510
 
@@ -542,7 +532,6 @@ with gr.Blocks() as demo_leaderboard:
542
  + [shown_columns.change for shown_columns in shown_columns_dict.values()],
543
  fn=update_table,
544
  inputs=[
545
- hidden_leaderboard_table_for_search,
546
  filter_columns_type,
547
  filter_columns_precision,
548
  filter_columns_size,
@@ -558,7 +547,7 @@ with gr.Blocks() as demo_leaderboard:
558
 
559
  leaderboard_table.change(
560
  fn=plot_size_vs_score,
561
- inputs=[leaderboard_table, hidden_leaderboard_table_for_search],
562
  outputs=graph_size_vs_score,
563
  api_name=False,
564
  queue=False,
@@ -566,7 +555,7 @@ with gr.Blocks() as demo_leaderboard:
566
 
567
  leaderboard_table.change(
568
  fn=plot_average_scores,
569
- inputs=[leaderboard_table, hidden_leaderboard_table_for_search],
570
  outputs=graph_average_scores,
571
  api_name=False,
572
  queue=False,
 
190
 
191
 
192
  def update_table(
 
193
  type_query: list,
194
  precision_query: str,
195
  size_query: list,
 
204
  print(
205
  f"Update table called with: type_query={type_query}, precision_query={precision_query}, size_query={size_query}"
206
  )
 
207
 
208
  filtered_df = filter_models(
209
+ ORIGINAL_DF,
210
  type_query,
211
  size_query,
212
  precision_query,
 
304
  return results
305
 
306
 
307
+ def plot_size_vs_score(df_filtered: pd.DataFrame) -> go.Figure:
308
+ df = ORIGINAL_DF[ORIGINAL_DF[AutoEvalColumn.row_id.name].isin(df_filtered[AutoEvalColumn.row_id.name])]
309
  df = df[df["#Params (B)"] > 0]
310
  df = df[["model_name_for_query", "#Params (B)", "AVG", "Few-shot"]]
311
  df["AVG"] = df["AVG"].astype(float)
 
331
  }
332
 
333
 
334
+ def plot_average_scores(df_filtered: pd.DataFrame) -> go.Figure:
335
+ df = ORIGINAL_DF[ORIGINAL_DF[AutoEvalColumn.row_id.name].isin(df_filtered[AutoEvalColumn.row_id.name])]
336
  df = df[["model_name_for_query", "Few-shot"] + list(TASK_AVG_NAME_MAP.keys())]
337
  df = df.rename(columns={"model_name_for_query": "Model", "Few-shot": "n-shot"})
338
  df = df.rename(columns=TASK_AVG_NAME_MAP)
 
495
  graph_size_vs_score = gr.Plot(label="Model size vs. Average score")
496
  graph_average_scores = gr.Plot(label="Model Performance across Task Categories")
497
 
 
 
 
 
 
 
 
 
498
  # Define a hidden component that will trigger a reload only if a query parameter has been set
499
  hidden_search_bar = gr.Textbox(value="", visible=False)
500
 
 
532
  + [shown_columns.change for shown_columns in shown_columns_dict.values()],
533
  fn=update_table,
534
  inputs=[
 
535
  filter_columns_type,
536
  filter_columns_precision,
537
  filter_columns_size,
 
547
 
548
  leaderboard_table.change(
549
  fn=plot_size_vs_score,
550
+ inputs=leaderboard_table,
551
  outputs=graph_size_vs_score,
552
  api_name=False,
553
  queue=False,
 
555
 
556
  leaderboard_table.change(
557
  fn=plot_average_scores,
558
+ inputs=leaderboard_table,
559
  outputs=graph_average_scores,
560
  api_name=False,
561
  queue=False,