albertvillanova HF staff commited on
Commit
81f1dd1
1 Parent(s): 6679087

Simplify metrics names

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -69,14 +69,7 @@ def load_result_dataframe(model_id):
69
 
70
  def display_results(df_1, df_2, task):
71
  df = pd.concat([df.set_index("index") for df in [df_1, df_2] if "index" in df.columns])
72
- df = df.T.rename_axis(columns=None) # index="Parameters", # .reset_index()
73
- # return display_dataframe(df)
74
- # d = df.set_index(df.index.str.split(".")) # .split return a list instead of a tuple
75
- # results = d.loc[d.index.str[0] == "results"]
76
- # results.index = results.index.str.join(".")
77
- # configs = d.loc[d.index.str[0] == "configs"]
78
- # configs.index = configs.index.str.join(".")
79
- # return display_dataframe(results), display_dataframe(configs)
80
  return display_results_tab(df, task), display_configs_tab(df, task)
81
 
82
 
@@ -95,7 +88,8 @@ def display_results_tab(df, task):
95
  ],
96
  axis="index",
97
  )
98
- df.format_index(lambda idx: idx[len("results.leaderboard_"):].removesuffix(",none"), axis="index")
 
99
  return df.to_html()
100
 
101
 
@@ -114,7 +108,8 @@ def display_configs_tab(df, task):
114
  ],
115
  axis="index",
116
  )
117
- df.format_index(lambda idx: idx[len("configs.leaderboard_"):], axis="index")
 
118
  return df.to_html()
119
 
120
 
 
69
 
70
  def display_results(df_1, df_2, task):
71
  df = pd.concat([df.set_index("index") for df in [df_1, df_2] if "index" in df.columns])
72
+ df = df.T.rename_axis(columns=None)
 
 
 
 
 
 
 
73
  return display_results_tab(df, task), display_configs_tab(df, task)
74
 
75
 
 
88
  ],
89
  axis="index",
90
  )
91
+ start = len("results.leaderboard_") if task == "All" else len(f"results.{task} ")
92
+ df.format_index(lambda idx: idx[start:].removesuffix(",none"), axis="index")
93
  return df.to_html()
94
 
95
 
 
108
  ],
109
  axis="index",
110
  )
111
+ start = len("configs.leaderboard_") if task == "All" else len(f"configs.{task} ")
112
+ df.format_index(lambda idx: idx[start:], axis="index")
113
  return df.to_html()
114
 
115