Spaces:
Running
Running
Update leaderboard.py
Browse files- leaderboard.py +18 -18
leaderboard.py
CHANGED
@@ -129,20 +129,20 @@ def get_leaderboard():
|
|
129 |
# Get human readable name
|
130 |
human_readable = get_human_readable_name(model)
|
131 |
|
132 |
-
# Format the row
|
133 |
row = [
|
134 |
-
0,
|
135 |
-
human_readable,
|
136 |
-
score,
|
137 |
-
wins,
|
138 |
-
losses,
|
139 |
-
total_battles,
|
140 |
-
win_rate
|
141 |
]
|
142 |
table_data.append(row)
|
143 |
|
144 |
# Sort by score (descending)
|
145 |
-
table_data.sort(key=lambda x: x[2], reverse=True)
|
146 |
|
147 |
# Add position numbers after sorting
|
148 |
for i, row in enumerate(table_data, 1):
|
@@ -195,20 +195,20 @@ def get_elo_leaderboard():
|
|
195 |
# Get human readable name
|
196 |
human_readable = get_human_readable_name(model)
|
197 |
|
198 |
-
# Format the row
|
199 |
row = [
|
200 |
-
0,
|
201 |
-
human_readable,
|
202 |
-
rating,
|
203 |
-
wins,
|
204 |
-
losses,
|
205 |
-
total_battles,
|
206 |
-
win_rate
|
207 |
]
|
208 |
table_data.append(row)
|
209 |
|
210 |
# Sort by ELO rating (descending)
|
211 |
-
table_data.sort(key=lambda x: x[2], reverse=True)
|
212 |
|
213 |
# Add position numbers after sorting
|
214 |
for i, row in enumerate(table_data, 1):
|
|
|
129 |
# Get human readable name
|
130 |
human_readable = get_human_readable_name(model)
|
131 |
|
132 |
+
# Format the row with formatted strings for display
|
133 |
row = [
|
134 |
+
0, # Position placeholder (integer)
|
135 |
+
human_readable, # String
|
136 |
+
f"{score:.3f}", # Score formatted to 3 decimal places
|
137 |
+
wins, # Integer
|
138 |
+
losses, # Integer
|
139 |
+
total_battles, # Integer
|
140 |
+
f"{win_rate:.1%}" # Win rate as percentage
|
141 |
]
|
142 |
table_data.append(row)
|
143 |
|
144 |
# Sort by score (descending)
|
145 |
+
table_data.sort(key=lambda x: float(x[2].replace('%', '')), reverse=True)
|
146 |
|
147 |
# Add position numbers after sorting
|
148 |
for i, row in enumerate(table_data, 1):
|
|
|
195 |
# Get human readable name
|
196 |
human_readable = get_human_readable_name(model)
|
197 |
|
198 |
+
# Format the row with formatted strings for display
|
199 |
row = [
|
200 |
+
0, # Position placeholder (integer)
|
201 |
+
human_readable, # String
|
202 |
+
f"{rating:.1f}", # ELO rating formatted to 1 decimal place
|
203 |
+
wins, # Integer
|
204 |
+
losses, # Integer
|
205 |
+
total_battles, # Integer
|
206 |
+
f"{win_rate:.1%}" # Win rate as percentage
|
207 |
]
|
208 |
table_data.append(row)
|
209 |
|
210 |
# Sort by ELO rating (descending)
|
211 |
+
table_data.sort(key=lambda x: float(x[2]), reverse=True)
|
212 |
|
213 |
# Add position numbers after sorting
|
214 |
for i, row in enumerate(table_data, 1):
|