Spaces:
Running
Running
Highlight wins and loses
Browse files
server.py
CHANGED
|
@@ -217,14 +217,14 @@ class LeaderboardServer:
|
|
| 217 |
self.submission_id_to_model_title[submission_id] = metadata["team_name"] + "/" + metadata["model_name"]
|
| 218 |
|
| 219 |
@staticmethod
|
| 220 |
-
def
|
| 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: rgba(0, 255, 0, 0.
|
| 226 |
elif x[c].iloc[i] == False:
|
| 227 |
-
df_css[c].iloc[i] = 'background-color: rgba(255, 0, 0, 0.
|
| 228 |
else:
|
| 229 |
df_css[c].iloc[i] = ''
|
| 230 |
return df_css
|
|
@@ -283,7 +283,7 @@ class LeaderboardServer:
|
|
| 283 |
dataframe = dataframe.rename(
|
| 284 |
columns=attributes_map_word_to_header
|
| 285 |
)
|
| 286 |
-
dataframe = dataframe.style.apply(self.
|
| 287 |
return dataframe
|
| 288 |
|
| 289 |
def get_leaderboard(self, pre_submit=None, category=None):
|
|
|
|
| 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_and_false(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: rgba(0, 255, 0, 0.1);'
|
| 226 |
elif x[c].iloc[i] == False:
|
| 227 |
+
df_css[c].iloc[i] = 'background-color: rgba(255, 0, 0, 0.1);'
|
| 228 |
else:
|
| 229 |
df_css[c].iloc[i] = ''
|
| 230 |
return df_css
|
|
|
|
| 283 |
dataframe = dataframe.rename(
|
| 284 |
columns=attributes_map_word_to_header
|
| 285 |
)
|
| 286 |
+
dataframe = dataframe.style.apply(self._model_tournament_table_highlight_true_and_false, axis=None)
|
| 287 |
return dataframe
|
| 288 |
|
| 289 |
def get_leaderboard(self, pre_submit=None, category=None):
|