Spaces:
Runtime error
Runtime error
Default sorting of leaderboard is by "average_score"
Browse files
server.py
CHANGED
@@ -753,6 +753,7 @@ class LeaderboardServer:
|
|
753 |
"n-shot",
|
754 |
"average_score",
|
755 |
]
|
|
|
756 |
df_order = [
|
757 |
key
|
758 |
for key in dict.fromkeys(
|
@@ -764,13 +765,26 @@ class LeaderboardServer:
|
|
764 |
).keys()
|
765 |
if key in dataframe.columns
|
766 |
]
|
|
|
|
|
767 |
dataframe = dataframe[df_order]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
768 |
attributes_map_word_to_header = {key: value["abbreviation"] for key, value in self.TASKS_METADATA.items()}
|
769 |
attributes_map_word_to_header.update(extra_attributes_map_word_to_header)
|
770 |
attributes_map_word_to_header.update(visible_metrics_map_word_to_header)
|
771 |
dataframe = dataframe.rename(
|
772 |
columns=attributes_map_word_to_header
|
773 |
)
|
|
|
774 |
return dataframe
|
775 |
|
776 |
def fake_tournament(self, new_submission_id, new_model_file):
|
|
|
753 |
"n-shot",
|
754 |
"average_score",
|
755 |
]
|
756 |
+
|
757 |
df_order = [
|
758 |
key
|
759 |
for key in dict.fromkeys(
|
|
|
765 |
).keys()
|
766 |
if key in dataframe.columns
|
767 |
]
|
768 |
+
|
769 |
+
# Sort columns
|
770 |
dataframe = dataframe[df_order]
|
771 |
+
|
772 |
+
# Sort rows
|
773 |
+
if pre_submit:
|
774 |
+
first_row_with_pre_submit = dataframe.iloc[0]
|
775 |
+
dataframe = dataframe.iloc[1:].sort_values(by=["average_score"], ascending=False)
|
776 |
+
dataframe = pd.concat([first_row_with_pre_submit.to_frame().T, dataframe])
|
777 |
+
else:
|
778 |
+
dataframe = dataframe.sort_values(by=["average_score"], ascending=False)
|
779 |
+
|
780 |
+
# Rename columns
|
781 |
attributes_map_word_to_header = {key: value["abbreviation"] for key, value in self.TASKS_METADATA.items()}
|
782 |
attributes_map_word_to_header.update(extra_attributes_map_word_to_header)
|
783 |
attributes_map_word_to_header.update(visible_metrics_map_word_to_header)
|
784 |
dataframe = dataframe.rename(
|
785 |
columns=attributes_map_word_to_header
|
786 |
)
|
787 |
+
|
788 |
return dataframe
|
789 |
|
790 |
def fake_tournament(self, new_submission_id, new_model_file):
|