Clémentine commited on
Commit
bd73591
1 Parent(s): c3110e4
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -17,10 +17,12 @@ owner="clefourrier" # change to balm once possible
17
  api = HfApi()
18
 
19
  eval_results = {}
20
- eval_dataframe = {}
21
  for level in range(1, 4):
22
  eval_results[level] = load_dataset(f"{owner}/BALM_ResultsLevel{level}", use_auth_token=BALM_TOKEN, split="dev")
23
- eval_dataframe[level] = pd.DataFrame(eval_results[level].remove_columns("mail"))
 
 
 
24
 
25
  def restart_space():
26
  api.restart_space(repo_id=f"{owner}/BALM_Leaderboard", token=BALM_TOKEN)
@@ -67,11 +69,12 @@ def add_new_eval(
67
 
68
  def refresh():
69
  eval_results = {}
70
- eval_dataframe = {}
71
  for level in range(1, 4):
72
  eval_results[level] = load_dataset(f"{owner}/BALM_ResultsLevel{level}", use_auth_token=BALM_TOKEN, split="dev")
73
- eval_dataframe[level] = pd.DataFrame(eval_results[level].remove_columns("mail"))
74
- return eval_dataframe[1], eval_dataframe[2], eval_dataframe[3]
 
 
75
 
76
 
77
  custom_css = """
@@ -121,21 +124,21 @@ with demo:
121
  with gr.Tab("Results: Level 1"):
122
  with gr.Tab("Results on Dev Set"):
123
  leaderboard_table_1 = gr.components.Dataframe(
124
- value=eval_dataframe[1], headers=COLS, datatype=TYPES, max_rows=20
125
  )
126
  with gr.Tab("Results on Test Set"):
127
  gr.Textbox(value="The test set is currently private! Come back when performances on the dev set increased!")
128
  with gr.Tab("Results: Level 2"):
129
  with gr.Tab("Results on Dev Set"):
130
  leaderboard_table_2 = gr.components.Dataframe(
131
- value=eval_dataframe[2], headers=COLS, datatype=TYPES, max_rows=20
132
  )
133
  with gr.Tab("Results on Test Set"):
134
  gr.Textbox(value="The test set is currently private! Come back when performances on the dev set increased!")
135
  with gr.Tab("Results: Level 3"):
136
  with gr.Tab("Results on Dev Set"):
137
  leaderboard_table_3 = gr.components.Dataframe(
138
- value=eval_dataframe[3], headers=COLS, datatype=TYPES, max_rows=20
139
  )
140
  with gr.Tab("Results on Test Set"):
141
  gr.Textbox(value="The test set is currently private! Come back when performances on the dev set increased!")
@@ -145,9 +148,9 @@ with demo:
145
  refresh,
146
  inputs=[],
147
  outputs=[
148
- eval_dataframe[1],
149
- eval_dataframe[2],
150
- eval_dataframe[3],
151
  ],
152
  )
153
 
 
17
  api = HfApi()
18
 
19
  eval_results = {}
 
20
  for level in range(1, 4):
21
  eval_results[level] = load_dataset(f"{owner}/BALM_ResultsLevel{level}", use_auth_token=BALM_TOKEN, split="dev")
22
+
23
+ eval_dataframe_1 = pd.DataFrame(eval_results[1].remove_columns("mail"))
24
+ eval_dataframe_2 = pd.DataFrame(eval_results[2].remove_columns("mail"))
25
+ eval_dataframe_3 = pd.DataFrame(eval_results[3].remove_columns("mail"))
26
 
27
  def restart_space():
28
  api.restart_space(repo_id=f"{owner}/BALM_Leaderboard", token=BALM_TOKEN)
 
69
 
70
  def refresh():
71
  eval_results = {}
 
72
  for level in range(1, 4):
73
  eval_results[level] = load_dataset(f"{owner}/BALM_ResultsLevel{level}", use_auth_token=BALM_TOKEN, split="dev")
74
+ eval_dataframe_1 = pd.DataFrame(eval_results[1].remove_columns("mail"))
75
+ eval_dataframe_2 = pd.DataFrame(eval_results[2].remove_columns("mail"))
76
+ eval_dataframe_3 = pd.DataFrame(eval_results[3].remove_columns("mail"))
77
+ return eval_dataframe_1, eval_dataframe_2, eval_dataframe_3
78
 
79
 
80
  custom_css = """
 
124
  with gr.Tab("Results: Level 1"):
125
  with gr.Tab("Results on Dev Set"):
126
  leaderboard_table_1 = gr.components.Dataframe(
127
+ value=eval_dataframe_1, headers=COLS, datatype=TYPES, max_rows=20
128
  )
129
  with gr.Tab("Results on Test Set"):
130
  gr.Textbox(value="The test set is currently private! Come back when performances on the dev set increased!")
131
  with gr.Tab("Results: Level 2"):
132
  with gr.Tab("Results on Dev Set"):
133
  leaderboard_table_2 = gr.components.Dataframe(
134
+ value=eval_dataframe_2, headers=COLS, datatype=TYPES, max_rows=20
135
  )
136
  with gr.Tab("Results on Test Set"):
137
  gr.Textbox(value="The test set is currently private! Come back when performances on the dev set increased!")
138
  with gr.Tab("Results: Level 3"):
139
  with gr.Tab("Results on Dev Set"):
140
  leaderboard_table_3 = gr.components.Dataframe(
141
+ value=eval_dataframe_3, headers=COLS, datatype=TYPES, max_rows=20
142
  )
143
  with gr.Tab("Results on Test Set"):
144
  gr.Textbox(value="The test set is currently private! Come back when performances on the dev set increased!")
 
148
  refresh,
149
  inputs=[],
150
  outputs=[
151
+ leaderboard_table_1,
152
+ leaderboard_table_2,
153
+ leaderboard_table_3,
154
  ],
155
  )
156