Spaces:
Runtime error
Runtime error
Try to highlight wins
Browse files
server.py
CHANGED
@@ -216,16 +216,16 @@ class LeaderboardServer:
|
|
216 |
self.submission_id_to_file[submission_id] = submission_file
|
217 |
self.submission_id_to_model_title[submission_id] = metadata["team_name"] + "/" + metadata["model_name"]
|
218 |
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
return
|
229 |
|
230 |
def get_model_tournament_table(self, submission_id, category):
|
231 |
if category == self.TASKS_CATEGORY_OVERALL:
|
@@ -245,7 +245,7 @@ class LeaderboardServer:
|
|
245 |
for task in self.tournament_results[submission_id][competitor_id]:
|
246 |
task_category = self.TASKS_METADATA[task]["category"]
|
247 |
if task_category == category:
|
248 |
-
match_results[task] =
|
249 |
|
250 |
model_link = data["metadata"]["link_to_model"]
|
251 |
model_title = data["metadata"]["team_name"] + "/" + data["metadata"]["model_name"]
|
@@ -281,7 +281,7 @@ class LeaderboardServer:
|
|
281 |
dataframe = dataframe.rename(
|
282 |
columns=attributes_map_word_to_header
|
283 |
)
|
284 |
-
dataframe = dataframe.
|
285 |
return dataframe
|
286 |
|
287 |
def get_leaderboard(self, pre_submit=None, category=None):
|
|
|
216 |
self.submission_id_to_file[submission_id] = submission_file
|
217 |
self.submission_id_to_model_title[submission_id] = metadata["team_name"] + "/" + metadata["model_name"]
|
218 |
|
219 |
+
@staticmethod
|
220 |
+
def _model_tournament_table_highlight_true(x):
|
221 |
+
df_css = x.copy()
|
222 |
+
for c in df_css:
|
223 |
+
for i in range(len(df_css.index)):
|
224 |
+
if x[c].iloc[i] == True:
|
225 |
+
df_css[c].iloc[i] = 'background-color: lightgreen'
|
226 |
+
else:
|
227 |
+
df_css[c].iloc[i] = ''
|
228 |
+
return df_css
|
229 |
|
230 |
def get_model_tournament_table(self, submission_id, category):
|
231 |
if category == self.TASKS_CATEGORY_OVERALL:
|
|
|
245 |
for task in self.tournament_results[submission_id][competitor_id]:
|
246 |
task_category = self.TASKS_METADATA[task]["category"]
|
247 |
if task_category == category:
|
248 |
+
match_results[task] = bool(self.tournament_results[submission_id][competitor_id][task])
|
249 |
|
250 |
model_link = data["metadata"]["link_to_model"]
|
251 |
model_title = data["metadata"]["team_name"] + "/" + data["metadata"]["model_name"]
|
|
|
281 |
dataframe = dataframe.rename(
|
282 |
columns=attributes_map_word_to_header
|
283 |
)
|
284 |
+
dataframe = dataframe.style.apply(self._model_tournament_table_highlight_true, axis=None)
|
285 |
return dataframe
|
286 |
|
287 |
def get_leaderboard(self, pre_submit=None, category=None):
|