Spaces:
Sleeping
Sleeping
Commit
·
6debba1
1
Parent(s):
1356e88
updated leaderboard
Browse files- app.py +5 -4
- match_outcomes.json +5 -0
app.py
CHANGED
|
@@ -388,7 +388,8 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
|
|
| 388 |
# Fetch latest predictions from the dataset repo
|
| 389 |
predictions = fetch_latest_predictions(match_id)
|
| 390 |
|
| 391 |
-
outcomes =
|
|
|
|
| 392 |
# Load existing match outcomes and user data from the test split
|
| 393 |
dataset = load_dataset("Jay-Rajput/DIS_IPL_Leads", split="train")
|
| 394 |
users = pd.DataFrame(dataset)
|
|
@@ -404,7 +405,7 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
|
|
| 404 |
outcomes.append({"match_id": match_id, "winning_team": winning_team, "man_of_the_match": man_of_the_match})
|
| 405 |
|
| 406 |
# Update user points based on prediction accuracy
|
| 407 |
-
for
|
| 408 |
user_name = prediction['user_name']
|
| 409 |
predicted_winner = prediction['predicted_winner']
|
| 410 |
predicted_motm = prediction['predicted_motm']
|
|
@@ -419,11 +420,11 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
|
|
| 419 |
else:
|
| 420 |
users[user_name] -= 200 + bid_points # Penalty for wrong team prediction
|
| 421 |
|
| 422 |
-
save_match_outcomes(outcomes)
|
| 423 |
users.to_json(USERS_JSON)
|
| 424 |
# Convert the updated DataFrame back to a Hugging Face Dataset and push updates
|
| 425 |
updated_dataset = Dataset.from_pandas(users)
|
| 426 |
updated_dataset.push_to_hub("Jay-Rajput/DIS_IPL_Leads", split="train")
|
|
|
|
| 427 |
|
| 428 |
|
| 429 |
with st.sidebar:
|
|
@@ -434,7 +435,7 @@ with st.sidebar:
|
|
| 434 |
expander.success("Authenticated")
|
| 435 |
|
| 436 |
all_matches = load_data(MATCHES_JSON)
|
| 437 |
-
match_outcomes =
|
| 438 |
submitted_match_ids = [outcome["match_id"] for outcome in match_outcomes]
|
| 439 |
|
| 440 |
# Filter matches to those that do not have outcomes submitted yet
|
|
|
|
| 388 |
# Fetch latest predictions from the dataset repo
|
| 389 |
predictions = fetch_latest_predictions(match_id)
|
| 390 |
|
| 391 |
+
outcomes = load_dataset("Jay-Rajput/DIS_IPL_Outcomes", split="train") # Load existing match outcomes
|
| 392 |
+
|
| 393 |
# Load existing match outcomes and user data from the test split
|
| 394 |
dataset = load_dataset("Jay-Rajput/DIS_IPL_Leads", split="train")
|
| 395 |
users = pd.DataFrame(dataset)
|
|
|
|
| 405 |
outcomes.append({"match_id": match_id, "winning_team": winning_team, "man_of_the_match": man_of_the_match})
|
| 406 |
|
| 407 |
# Update user points based on prediction accuracy
|
| 408 |
+
for idx, prediction in predictions.iterrows():
|
| 409 |
user_name = prediction['user_name']
|
| 410 |
predicted_winner = prediction['predicted_winner']
|
| 411 |
predicted_motm = prediction['predicted_motm']
|
|
|
|
| 420 |
else:
|
| 421 |
users[user_name] -= 200 + bid_points # Penalty for wrong team prediction
|
| 422 |
|
|
|
|
| 423 |
users.to_json(USERS_JSON)
|
| 424 |
# Convert the updated DataFrame back to a Hugging Face Dataset and push updates
|
| 425 |
updated_dataset = Dataset.from_pandas(users)
|
| 426 |
updated_dataset.push_to_hub("Jay-Rajput/DIS_IPL_Leads", split="train")
|
| 427 |
+
outcomes.push_to_hub("Jay-Rajput/DIS_IPL_Outcomes", split="train")
|
| 428 |
|
| 429 |
|
| 430 |
with st.sidebar:
|
|
|
|
| 435 |
expander.success("Authenticated")
|
| 436 |
|
| 437 |
all_matches = load_data(MATCHES_JSON)
|
| 438 |
+
match_outcomes = load_dataset("Jay-Rajput/DIS_IPL_Outcomes", split="train")
|
| 439 |
submitted_match_ids = [outcome["match_id"] for outcome in match_outcomes]
|
| 440 |
|
| 441 |
# Filter matches to those that do not have outcomes submitted yet
|
match_outcomes.json
CHANGED
|
@@ -88,5 +88,10 @@
|
|
| 88 |
"match_id": "20240405_18",
|
| 89 |
"winning_team": "SRH",
|
| 90 |
"man_of_the_match": "Abhishek Sharma"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
}
|
| 92 |
]
|
|
|
|
| 88 |
"match_id": "20240405_18",
|
| 89 |
"winning_team": "SRH",
|
| 90 |
"man_of_the_match": "Abhishek Sharma"
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"match_id": "20240406_19",
|
| 94 |
+
"winning_team": "RR",
|
| 95 |
+
"man_of_the_match": "Jos Buttler"
|
| 96 |
}
|
| 97 |
]
|