Spaces:
Sleeping
Sleeping
jarajpu
commited on
Commit
·
bb28c79
1
Parent(s):
acb0ebd
Adding leaderboard enhancement
Browse files- app.py +3 -16
- leaders/users.json +1 -152
- users.json +1 -152
app.py
CHANGED
|
@@ -314,14 +314,12 @@ def display_leaderboard():
|
|
| 314 |
if dataset:
|
| 315 |
for user, points_dict in dataset[0].items():
|
| 316 |
points = points_dict.get("0", 0)
|
| 317 |
-
|
| 318 |
-
users_data.append({'User': user, 'Points': points, 'Last 5': last_5})
|
| 319 |
else:
|
| 320 |
data = load_users(USERS_JSON)
|
| 321 |
for user, points_dict in data.items():
|
| 322 |
points = points_dict.get("0", 0)
|
| 323 |
-
|
| 324 |
-
users_data.append({'User': user, 'Points': points, 'Last 5': last_5})
|
| 325 |
|
| 326 |
leaderboard = pd.DataFrame(users_data)
|
| 327 |
|
|
@@ -332,18 +330,7 @@ def display_leaderboard():
|
|
| 332 |
leaderboard['Rank'] = range(1, len(leaderboard) + 1)
|
| 333 |
|
| 334 |
# Select and order the columns for display
|
| 335 |
-
leaderboard = leaderboard[['Rank', 'User', 'Points'
|
| 336 |
-
|
| 337 |
-
# Display colored circles for Last 5 details
|
| 338 |
-
for i, row in leaderboard.iterrows():
|
| 339 |
-
last_5_values = row['Last 5']
|
| 340 |
-
for value in last_5_values:
|
| 341 |
-
if value is True:
|
| 342 |
-
st.write('<span style="color:green">⚫</span>', unsafe_allow_html=True)
|
| 343 |
-
elif value is False:
|
| 344 |
-
st.write('<span style="color:red">⚫</span>', unsafe_allow_html=True)
|
| 345 |
-
else:
|
| 346 |
-
st.write('<span style="color:white">⚫</span>', unsafe_allow_html=True)
|
| 347 |
|
| 348 |
st.dataframe(leaderboard, hide_index=True)
|
| 349 |
except Exception as e:
|
|
|
|
| 314 |
if dataset:
|
| 315 |
for user, points_dict in dataset[0].items():
|
| 316 |
points = points_dict.get("0", 0)
|
| 317 |
+
users_data.append({'User': user, 'Points': points})
|
|
|
|
| 318 |
else:
|
| 319 |
data = load_users(USERS_JSON)
|
| 320 |
for user, points_dict in data.items():
|
| 321 |
points = points_dict.get("0", 0)
|
| 322 |
+
users_data.append({'User': user, 'Points': points})
|
|
|
|
| 323 |
|
| 324 |
leaderboard = pd.DataFrame(users_data)
|
| 325 |
|
|
|
|
| 330 |
leaderboard['Rank'] = range(1, len(leaderboard) + 1)
|
| 331 |
|
| 332 |
# Select and order the columns for display
|
| 333 |
+
leaderboard = leaderboard[['Rank', 'User', 'Points']]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
|
| 335 |
st.dataframe(leaderboard, hide_index=True)
|
| 336 |
except Exception as e:
|
leaders/users.json
CHANGED
|
@@ -1,152 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"Arpit": {
|
| 3 |
-
"0": 45181,
|
| 4 |
-
"last_5": [
|
| 5 |
-
false,
|
| 6 |
-
false,
|
| 7 |
-
true,
|
| 8 |
-
true,
|
| 9 |
-
true
|
| 10 |
-
]
|
| 11 |
-
},
|
| 12 |
-
"Ganesh": {
|
| 13 |
-
"0": 10251,
|
| 14 |
-
"last_5": [
|
| 15 |
-
null,
|
| 16 |
-
null,
|
| 17 |
-
null,
|
| 18 |
-
null,
|
| 19 |
-
null
|
| 20 |
-
]
|
| 21 |
-
},
|
| 22 |
-
"Haaris": {
|
| 23 |
-
"0": 13800,
|
| 24 |
-
"last_5": [
|
| 25 |
-
true,
|
| 26 |
-
true,
|
| 27 |
-
null,
|
| 28 |
-
null,
|
| 29 |
-
null
|
| 30 |
-
]
|
| 31 |
-
},
|
| 32 |
-
"Jay": {
|
| 33 |
-
"0": 23520,
|
| 34 |
-
"last_5": [
|
| 35 |
-
true,
|
| 36 |
-
true,
|
| 37 |
-
true,
|
| 38 |
-
true,
|
| 39 |
-
null
|
| 40 |
-
]
|
| 41 |
-
},
|
| 42 |
-
"Kishore": {
|
| 43 |
-
"0": 16620,
|
| 44 |
-
"last_5": [
|
| 45 |
-
false,
|
| 46 |
-
true,
|
| 47 |
-
true,
|
| 48 |
-
false,
|
| 49 |
-
null
|
| 50 |
-
]
|
| 51 |
-
},
|
| 52 |
-
"Megha": {
|
| 53 |
-
"0": 30420,
|
| 54 |
-
"last_5": [
|
| 55 |
-
false,
|
| 56 |
-
false,
|
| 57 |
-
true,
|
| 58 |
-
true,
|
| 59 |
-
true
|
| 60 |
-
]
|
| 61 |
-
},
|
| 62 |
-
"Naveein": {
|
| 63 |
-
"0": 26100,
|
| 64 |
-
"last_5": [
|
| 65 |
-
true,
|
| 66 |
-
true,
|
| 67 |
-
true,
|
| 68 |
-
null,
|
| 69 |
-
null
|
| 70 |
-
]
|
| 71 |
-
},
|
| 72 |
-
"Neha": {
|
| 73 |
-
"0": 7500,
|
| 74 |
-
"last_5": [
|
| 75 |
-
null,
|
| 76 |
-
null,
|
| 77 |
-
null,
|
| 78 |
-
null,
|
| 79 |
-
null
|
| 80 |
-
]
|
| 81 |
-
},
|
| 82 |
-
"Praveen": {
|
| 83 |
-
"0": 28123,
|
| 84 |
-
"last_5": [
|
| 85 |
-
false,
|
| 86 |
-
false,
|
| 87 |
-
true,
|
| 88 |
-
true,
|
| 89 |
-
null
|
| 90 |
-
]
|
| 91 |
-
},
|
| 92 |
-
"Rakesh": {
|
| 93 |
-
"0": 3416,
|
| 94 |
-
"last_5": [
|
| 95 |
-
null,
|
| 96 |
-
null,
|
| 97 |
-
null,
|
| 98 |
-
null,
|
| 99 |
-
null
|
| 100 |
-
]
|
| 101 |
-
},
|
| 102 |
-
"Sai": {
|
| 103 |
-
"0": 35061,
|
| 104 |
-
"last_5": [
|
| 105 |
-
true,
|
| 106 |
-
false,
|
| 107 |
-
true,
|
| 108 |
-
false,
|
| 109 |
-
null
|
| 110 |
-
]
|
| 111 |
-
},
|
| 112 |
-
"Sahil": {
|
| 113 |
-
"0": 29705,
|
| 114 |
-
"last_5": [
|
| 115 |
-
false,
|
| 116 |
-
false,
|
| 117 |
-
true,
|
| 118 |
-
true,
|
| 119 |
-
null
|
| 120 |
-
]
|
| 121 |
-
},
|
| 122 |
-
"Sunil": {
|
| 123 |
-
"0": 15212,
|
| 124 |
-
"last_5": [
|
| 125 |
-
false,
|
| 126 |
-
false,
|
| 127 |
-
true,
|
| 128 |
-
false,
|
| 129 |
-
true
|
| 130 |
-
]
|
| 131 |
-
},
|
| 132 |
-
"Vaibhav": {
|
| 133 |
-
"0": 11501,
|
| 134 |
-
"last_5": [
|
| 135 |
-
true,
|
| 136 |
-
null,
|
| 137 |
-
null,
|
| 138 |
-
null,
|
| 139 |
-
null
|
| 140 |
-
]
|
| 141 |
-
},
|
| 142 |
-
"Vinay": {
|
| 143 |
-
"0": 23220,
|
| 144 |
-
"last_5": [
|
| 145 |
-
true,
|
| 146 |
-
true,
|
| 147 |
-
false,
|
| 148 |
-
true,
|
| 149 |
-
false
|
| 150 |
-
]
|
| 151 |
-
}
|
| 152 |
-
}
|
|
|
|
| 1 |
+
{"Arpit": {"0": 45181}, "Ganesh": {"0": 10251}, "Haaris": {"0": 13800}, "Jay": {"0": 23520}, "Kishore": {"0": 16620}, "Megha": {"0": 30420}, "Naveein": {"0": 26100}, "Neha": {"0": 7500}, "Praveen": {"0": 28123}, "Rakesh": {"0": 3416}, "Sai": {"0": 35061}, "Sahil": {"0": 29705}, "Sunil": {"0": 15212}, "Vaibhav": {"0": 11501}, "Vinay": {"0": 23220}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
users.json
CHANGED
|
@@ -1,152 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"Arpit": {
|
| 3 |
-
"0": 45181,
|
| 4 |
-
"last_5": [
|
| 5 |
-
false,
|
| 6 |
-
false,
|
| 7 |
-
true,
|
| 8 |
-
true,
|
| 9 |
-
true
|
| 10 |
-
]
|
| 11 |
-
},
|
| 12 |
-
"Ganesh": {
|
| 13 |
-
"0": 10251,
|
| 14 |
-
"last_5": [
|
| 15 |
-
null,
|
| 16 |
-
null,
|
| 17 |
-
null,
|
| 18 |
-
null,
|
| 19 |
-
null
|
| 20 |
-
]
|
| 21 |
-
},
|
| 22 |
-
"Haaris": {
|
| 23 |
-
"0": 13800,
|
| 24 |
-
"last_5": [
|
| 25 |
-
true,
|
| 26 |
-
true,
|
| 27 |
-
null,
|
| 28 |
-
null,
|
| 29 |
-
null
|
| 30 |
-
]
|
| 31 |
-
},
|
| 32 |
-
"Jay": {
|
| 33 |
-
"0": 23520,
|
| 34 |
-
"last_5": [
|
| 35 |
-
true,
|
| 36 |
-
true,
|
| 37 |
-
true,
|
| 38 |
-
true,
|
| 39 |
-
null
|
| 40 |
-
]
|
| 41 |
-
},
|
| 42 |
-
"Kishore": {
|
| 43 |
-
"0": 16620,
|
| 44 |
-
"last_5": [
|
| 45 |
-
false,
|
| 46 |
-
true,
|
| 47 |
-
true,
|
| 48 |
-
false,
|
| 49 |
-
null
|
| 50 |
-
]
|
| 51 |
-
},
|
| 52 |
-
"Megha": {
|
| 53 |
-
"0": 30420,
|
| 54 |
-
"last_5": [
|
| 55 |
-
false,
|
| 56 |
-
false,
|
| 57 |
-
true,
|
| 58 |
-
true,
|
| 59 |
-
true
|
| 60 |
-
]
|
| 61 |
-
},
|
| 62 |
-
"Naveein": {
|
| 63 |
-
"0": 26100,
|
| 64 |
-
"last_5": [
|
| 65 |
-
true,
|
| 66 |
-
true,
|
| 67 |
-
true,
|
| 68 |
-
null,
|
| 69 |
-
null
|
| 70 |
-
]
|
| 71 |
-
},
|
| 72 |
-
"Neha": {
|
| 73 |
-
"0": 7500,
|
| 74 |
-
"last_5": [
|
| 75 |
-
null,
|
| 76 |
-
null,
|
| 77 |
-
null,
|
| 78 |
-
null,
|
| 79 |
-
null
|
| 80 |
-
]
|
| 81 |
-
},
|
| 82 |
-
"Praveen": {
|
| 83 |
-
"0": 28123,
|
| 84 |
-
"last_5": [
|
| 85 |
-
false,
|
| 86 |
-
false,
|
| 87 |
-
true,
|
| 88 |
-
true,
|
| 89 |
-
null
|
| 90 |
-
]
|
| 91 |
-
},
|
| 92 |
-
"Rakesh": {
|
| 93 |
-
"0": 3416,
|
| 94 |
-
"last_5": [
|
| 95 |
-
null,
|
| 96 |
-
null,
|
| 97 |
-
null,
|
| 98 |
-
null,
|
| 99 |
-
null
|
| 100 |
-
]
|
| 101 |
-
},
|
| 102 |
-
"Sai": {
|
| 103 |
-
"0": 35061,
|
| 104 |
-
"last_5": [
|
| 105 |
-
true,
|
| 106 |
-
false,
|
| 107 |
-
true,
|
| 108 |
-
false,
|
| 109 |
-
null
|
| 110 |
-
]
|
| 111 |
-
},
|
| 112 |
-
"Sahil": {
|
| 113 |
-
"0": 29705,
|
| 114 |
-
"last_5": [
|
| 115 |
-
false,
|
| 116 |
-
false,
|
| 117 |
-
true,
|
| 118 |
-
true,
|
| 119 |
-
null
|
| 120 |
-
]
|
| 121 |
-
},
|
| 122 |
-
"Sunil": {
|
| 123 |
-
"0": 15212,
|
| 124 |
-
"last_5": [
|
| 125 |
-
false,
|
| 126 |
-
false,
|
| 127 |
-
true,
|
| 128 |
-
false,
|
| 129 |
-
true
|
| 130 |
-
]
|
| 131 |
-
},
|
| 132 |
-
"Vaibhav": {
|
| 133 |
-
"0": 11501,
|
| 134 |
-
"last_5": [
|
| 135 |
-
true,
|
| 136 |
-
null,
|
| 137 |
-
null,
|
| 138 |
-
null,
|
| 139 |
-
null
|
| 140 |
-
]
|
| 141 |
-
},
|
| 142 |
-
"Vinay": {
|
| 143 |
-
"0": 23220,
|
| 144 |
-
"last_5": [
|
| 145 |
-
true,
|
| 146 |
-
true,
|
| 147 |
-
false,
|
| 148 |
-
true,
|
| 149 |
-
false
|
| 150 |
-
]
|
| 151 |
-
}
|
| 152 |
-
}
|
|
|
|
| 1 |
+
{"Arpit": {"0": 45181}, "Ganesh": {"0": 10251}, "Haaris": {"0": 13800}, "Jay": {"0": 23520}, "Kishore": {"0": 16620}, "Megha": {"0": 30420}, "Naveein": {"0": 26100}, "Neha": {"0": 7500}, "Praveen": {"0": 28123}, "Rakesh": {"0": 3416}, "Sai": {"0": 35061}, "Sahil": {"0": 29705}, "Sunil": {"0": 15212}, "Vaibhav": {"0": 11501}, "Vinay": {"0": 23220}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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