Lisa Dunlap commited on
Commit
0ba05dc
β€’
1 Parent(s): f61ae52

added arrow colors

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -426,6 +426,8 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=Fa
426
  elo_subset_results = category_elo_results[category]
427
  arena_df = arena_dfs["Total"]
428
  arena_values = get_arena_table(arena_df, model_table_df, arena_subset_df)
 
 
429
  p1 = elo_subset_results["win_fraction_heatmap"]
430
  p2 = elo_subset_results["battle_count_heatmap"]
431
  p3 = elo_subset_results["bootstrap_elo_rating"]
@@ -434,6 +436,18 @@ def build_leaderboard_tab(elo_results_file, leaderboard_table_file, show_plot=Fa
434
  """
435
  leaderboard_md = make_category_arena_leaderboard_md(arena_df, arena_subset_df, name=category)
436
  return arena_values, p1, p2, p3, p4, more_stats_md, leaderboard_md
 
 
 
 
 
 
 
 
 
 
 
 
437
 
438
  category_dropdown.change(update_leaderboard_and_plots, inputs=[category_dropdown], outputs=[elo_display_df, plot_1, plot_2, plot_3, plot_4, more_stats_md, category_deets])
439
 
 
426
  elo_subset_results = category_elo_results[category]
427
  arena_df = arena_dfs["Total"]
428
  arena_values = get_arena_table(arena_df, model_table_df, arena_subset_df)
429
+ if category != "Total":
430
+ arena_values = update_leaderboard_df(arena_values)
431
  p1 = elo_subset_results["win_fraction_heatmap"]
432
  p2 = elo_subset_results["battle_count_heatmap"]
433
  p3 = elo_subset_results["bootstrap_elo_rating"]
 
436
  """
437
  leaderboard_md = make_category_arena_leaderboard_md(arena_df, arena_subset_df, name=category)
438
  return arena_values, p1, p2, p3, p4, more_stats_md, leaderboard_md
439
+
440
+ def update_leaderboard_df(arena_table_vals):
441
+ elo_datarame = pd.DataFrame(arena_table_vals, columns=["Rank", "Model", "Arena Elo", "95% CI", "Votes", "Organization", "License", "Knowledge Cutoff"])
442
+
443
+ # goal: color the rows based on the rank with styler
444
+ def highlight_max(s):
445
+ # all items in S which contain up arrow should be green, down arrow should be red, otherwise black
446
+ return ["color: green" if "\u2191" in v else "color: red" if "\u2193" in v else "" for v in s]
447
+
448
+ styled_df = elo_datarame.style.apply(highlight_max, subset=["Rank"])
449
+
450
+ return styled_df
451
 
452
  category_dropdown.change(update_leaderboard_and_plots, inputs=[category_dropdown], outputs=[elo_display_df, plot_1, plot_2, plot_3, plot_4, more_stats_md, category_deets])
453