Spaces:
Running
Running
Changed "competitor_id" to "team_name/model_name"
Browse files
server.py
CHANGED
@@ -222,22 +222,34 @@ class LeaderboardServer:
|
|
222 |
|
223 |
with self.var_lock.ro:
|
224 |
for competitor_id in self.tournament_results[submission_id].keys() - {submission_id}: # without self
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
match_results = {}
|
226 |
-
match_results["competitor_id"] = competitor_id
|
227 |
for task in self.tournament_results[submission_id][competitor_id]:
|
228 |
task_category = self.TASKS_METADATA[task]["category"]
|
229 |
if task_category == category:
|
230 |
match_results[task] = bool(self.tournament_results[submission_id][competitor_id][task])
|
231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
model_tournament_table.append(match_results)
|
233 |
|
234 |
dataframe = pd.DataFrame.from_records(model_tournament_table)
|
235 |
|
236 |
extra_attributes_map_word_to_header = {
|
237 |
-
"
|
238 |
}
|
239 |
first_attributes = [
|
240 |
-
"
|
241 |
]
|
242 |
df_order = [
|
243 |
key
|
|
|
222 |
|
223 |
with self.var_lock.ro:
|
224 |
for competitor_id in self.tournament_results[submission_id].keys() - {submission_id}: # without self
|
225 |
+
path = self.submission_id_to_file.get(competitor_id)
|
226 |
+
if path:
|
227 |
+
data = json.load(open(path))
|
228 |
+
else:
|
229 |
+
raise gr.Error(f"Submission [{competitor_id}] not found")
|
230 |
+
|
231 |
match_results = {}
|
|
|
232 |
for task in self.tournament_results[submission_id][competitor_id]:
|
233 |
task_category = self.TASKS_METADATA[task]["category"]
|
234 |
if task_category == category:
|
235 |
match_results[task] = bool(self.tournament_results[submission_id][competitor_id][task])
|
236 |
|
237 |
+
model_link = data["metadata"]["link_to_model"]
|
238 |
+
model_title = data["metadata"]["team_name"] + "/" + data["metadata"]["model_name"]
|
239 |
+
model_title_abbr_team_name = self.abbreviate(data["metadata"]["team_name"], 28)
|
240 |
+
model_title_abbr_model_name = self.abbreviate(data["metadata"]["model_name"], 28)
|
241 |
+
model_title_abbr_html = f'<div style="font-size: 10px;">{xmlEscape(model_title_abbr_team_name, MARKDOWN_SPECIAL_CHARACTERS)}</div>{xmlEscape(model_title_abbr_model_name, MARKDOWN_SPECIAL_CHARACTERS)}'
|
242 |
+
match_results["model"] = f'<a href={xmlQuoteAttr(model_link)} title={xmlQuoteAttr(model_title)}>{model_title_abbr_html}</a>'
|
243 |
+
|
244 |
model_tournament_table.append(match_results)
|
245 |
|
246 |
dataframe = pd.DataFrame.from_records(model_tournament_table)
|
247 |
|
248 |
extra_attributes_map_word_to_header = {
|
249 |
+
"model": "Competitor",
|
250 |
}
|
251 |
first_attributes = [
|
252 |
+
"model",
|
253 |
]
|
254 |
df_order = [
|
255 |
key
|