Spaces:
Sleeping
Sleeping
jarajpu
commited on
Commit
·
cf0b0bc
1
Parent(s):
5eccd13
enhanced leaderboard
Browse files- app.py +7 -8
- leaders/users.json +1 -1
- users.json +1 -1
app.py
CHANGED
|
@@ -398,8 +398,7 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
|
|
| 398 |
outcomes = load_dataset("Jay-Rajput/DIS_IPL_Outcomes", split="train") # Load existing match outcomes
|
| 399 |
|
| 400 |
# Load existing match outcomes and user data from the test split
|
| 401 |
-
|
| 402 |
-
users = pd.DataFrame(dataset)
|
| 403 |
|
| 404 |
# Directly update or add the match outcome
|
| 405 |
outcome_exists = False
|
|
@@ -420,18 +419,18 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
|
|
| 420 |
|
| 421 |
# Update points based on prediction accuracy
|
| 422 |
if predicted_winner == winning_team:
|
| 423 |
-
users[user_name] += 1000
|
| 424 |
-
users[user_name] += bid_points
|
| 425 |
if predicted_motm == man_of_the_match:
|
| 426 |
-
users[user_name] += 400 # Bonus for both correct predictions
|
| 427 |
else:
|
| 428 |
-
users[user_name] -= 200 + bid_points # Penalty for wrong team prediction
|
| 429 |
|
| 430 |
users.to_json(USERS_JSON)
|
| 431 |
outcomes.to_json(OUTCOMES)
|
| 432 |
# Convert the updated DataFrame back to a Hugging Face Dataset and push updates
|
| 433 |
-
updated_dataset = Dataset.from_pandas(users)
|
| 434 |
-
|
| 435 |
outcomes.push_to_hub("Jay-Rajput/DIS_IPL_Outcomes", split="train")
|
| 436 |
|
| 437 |
|
|
|
|
| 398 |
outcomes = load_dataset("Jay-Rajput/DIS_IPL_Outcomes", split="train") # Load existing match outcomes
|
| 399 |
|
| 400 |
# Load existing match outcomes and user data from the test split
|
| 401 |
+
users = load_dataset("Jay-Rajput/DIS_IPL_Leads", split="train")
|
|
|
|
| 402 |
|
| 403 |
# Directly update or add the match outcome
|
| 404 |
outcome_exists = False
|
|
|
|
| 419 |
|
| 420 |
# Update points based on prediction accuracy
|
| 421 |
if predicted_winner == winning_team:
|
| 422 |
+
users[user_name][0]['0'] += 1000
|
| 423 |
+
users[user_name][0]['0'] += bid_points
|
| 424 |
if predicted_motm == man_of_the_match:
|
| 425 |
+
users[user_name][0]['0'] += 400 # Bonus for both correct predictions
|
| 426 |
else:
|
| 427 |
+
users[user_name][0]['0'] -= 200 + bid_points # Penalty for wrong team prediction
|
| 428 |
|
| 429 |
users.to_json(USERS_JSON)
|
| 430 |
outcomes.to_json(OUTCOMES)
|
| 431 |
# Convert the updated DataFrame back to a Hugging Face Dataset and push updates
|
| 432 |
+
# updated_dataset = Dataset.from_pandas(users)
|
| 433 |
+
users.push_to_hub("Jay-Rajput/DIS_IPL_Leads", split="train")
|
| 434 |
outcomes.push_to_hub("Jay-Rajput/DIS_IPL_Outcomes", split="train")
|
| 435 |
|
| 436 |
|
leaders/users.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"Arpit":{"0":
|
|
|
|
| 1 |
+
{"Arpit":{"0":22513},"Ganesh":{"0":10251},"Haaris":{"0":26200},"Jay":{"0":11500},"Kishore":{"0":13220},"Megha":{"0":19850},"Naveein":{"0":13200},"Neha":{"0":7500},"Praveen":{"0":23024},"Rakesh":{"0":4820},"Sai":{"0":22384},"Sahil":{"0":19880},"Sunil":{"0":5891},"Vaibhav":{"0":6318},"Vinay":{"0":17720}}
|
users.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"Arpit":{"0":
|
|
|
|
| 1 |
+
{"Arpit":{"0":22513},"Ganesh":{"0":10251},"Haaris":{"0":26200},"Jay":{"0":11500},"Kishore":{"0":13220},"Megha":{"0":19850},"Naveein":{"0":13200},"Neha":{"0":7500},"Praveen":{"0":23024},"Rakesh":{"0":4820},"Sai":{"0":22384},"Sahil":{"0":19880},"Sunil":{"0":5891},"Vaibhav":{"0":6318},"Vinay":{"0":17720}}
|