Abhishek Thakur
commited on
Commit
Β·
5c5968f
1
Parent(s):
f53f9d6
leaderboard
Browse files- config.py +1 -0
- pages/2_π_Leaderboard.py +35 -16
config.py
CHANGED
@@ -19,3 +19,4 @@ SUBMISSION_LIMIT = int(os.getenv("SUBMISSION_LIMIT"))
|
|
19 |
SELECTION_LIMIT = int(os.getenv("SELECTION_LIMIT"))
|
20 |
END_DATE = os.getenv("END_DATE")
|
21 |
END_DATE = datetime.strptime(END_DATE, "%Y-%m-%d")
|
|
|
|
19 |
SELECTION_LIMIT = int(os.getenv("SELECTION_LIMIT"))
|
20 |
END_DATE = os.getenv("END_DATE")
|
21 |
END_DATE = datetime.strptime(END_DATE, "%Y-%m-%d")
|
22 |
+
EVAL_HIGHER_IS_BETTER = True if int(os.getenv("EVAL_HIGHER_IS_BETTER")) == 1 else False
|
pages/2_π_Leaderboard.py
CHANGED
@@ -21,24 +21,43 @@ def fetch_leaderboard(private=False):
|
|
21 |
for submission in glob.glob(os.path.join(submissions_folder, "*.json")):
|
22 |
with open(submission, "r") as f:
|
23 |
submission_info = json.load(f)
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
print(submissions)
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
"
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
]
|
39 |
-
|
40 |
-
|
41 |
-
st.table(
|
42 |
|
43 |
|
44 |
def app():
|
|
|
21 |
for submission in glob.glob(os.path.join(submissions_folder, "*.json")):
|
22 |
with open(submission, "r") as f:
|
23 |
submission_info = json.load(f)
|
24 |
+
print(config.EVAL_HIGHER_IS_BETTER)
|
25 |
+
if config.EVAL_HIGHER_IS_BETTER:
|
26 |
+
submission_info["submissions"].sort(
|
27 |
+
key=lambda x: x["private_score"] if private else x["public_score"], reverse=True
|
28 |
+
)
|
29 |
+
else:
|
30 |
+
submission_info["submissions"].sort(key=lambda x: x["private_score"] if private else x["public_score"])
|
31 |
+
# select only the best submission
|
32 |
+
submission_info["submissions"] = submission_info["submissions"][0]
|
33 |
+
temp_info = {
|
34 |
+
"id": submission_info["id"],
|
35 |
+
"name": submission_info["name"],
|
36 |
+
"submission_id": submission_info["submissions"]["submission_id"],
|
37 |
+
"submission_comment": submission_info["submissions"]["submission_comment"],
|
38 |
+
"status": submission_info["submissions"]["status"],
|
39 |
+
"selected": submission_info["submissions"]["selected"],
|
40 |
+
"public_score": submission_info["submissions"]["public_score"],
|
41 |
+
"private_score": submission_info["submissions"]["private_score"],
|
42 |
+
"submission_date": submission_info["submissions"]["date"],
|
43 |
+
}
|
44 |
+
submissions.append(temp_info)
|
45 |
print(submissions)
|
46 |
|
47 |
+
df = pd.DataFrame(submissions)
|
48 |
+
# sort by public score and then by submission_date
|
49 |
+
df = df.sort_values(
|
50 |
+
by=["public_score", "submission_date"],
|
51 |
+
ascending=True if not config.EVAL_HIGHER_IS_BETTER else False,
|
52 |
+
)
|
53 |
+
df = df.reset_index(drop=True)
|
54 |
+
df["rank"] = df.index + 1
|
55 |
+
|
56 |
+
if private:
|
57 |
+
columns = ["rank", "name", "private_score", "submission_date"]
|
58 |
+
else:
|
59 |
+
columns = ["rank", "name", "public_score", "submission_date"]
|
60 |
+
st.table(df[columns])
|
61 |
|
62 |
|
63 |
def app():
|