albertvillanova HF staff commited on
Commit
26e855f
1 Parent(s): 0a4c821

Highlight min/max Results accuracy

Browse files
Files changed (1) hide show
  1. src/results.py +9 -0
src/results.py CHANGED
@@ -1,6 +1,7 @@
1
  import json
2
 
3
  import gradio as gr
 
4
  import pandas as pd
5
  from huggingface_hub import HfFileSystem
6
 
@@ -72,6 +73,7 @@ def display_tab(tab, df, task):
72
  ],
73
  axis="index",
74
  )
 
75
  start = len(f"{tab}.leaderboard_") if task == "All" else len(f"{tab}.{task} ")
76
  df.format_index(lambda idx: idx[start:].removesuffix(",none"), axis="index")
77
  return df.to_html()
@@ -104,3 +106,10 @@ def clear_results():
104
  ),
105
  ) * 2,
106
  )
 
 
 
 
 
 
 
 
1
  import json
2
 
3
  import gradio as gr
4
+ import numpy as np
5
  import pandas as pd
6
  from huggingface_hub import HfFileSystem
7
 
 
73
  ],
74
  axis="index",
75
  )
76
+ df.apply(highlight_min_max, axis=1)
77
  start = len(f"{tab}.leaderboard_") if task == "All" else len(f"{tab}.{task} ")
78
  df.format_index(lambda idx: idx[start:].removesuffix(",none"), axis="index")
79
  return df.to_html()
 
106
  ),
107
  ) * 2,
108
  )
109
+
110
+
111
+ def highlight_min_max(s):
112
+ if s.name.endswith("acc,none") or s.name.endswith("acc_norm,none"):
113
+ return np.where(s == np.nanmax(s.values), "background-color:darkgreen", "background-color:darkred")
114
+ else:
115
+ return [""] * len(s)