Spaces:
Sleeping
Sleeping
jarajpu
commited on
Commit
·
9cde32b
1
Parent(s):
d724e2b
Fixing match schedule
Browse files- app.py +9 -3
- leaders/users.json +1 -1
- match_outcomes.json +50 -0
- matches.json +4 -4
- outcomes/match_outcomes.json +50 -0
- users.json +1 -1
app.py
CHANGED
|
@@ -396,6 +396,7 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
|
|
| 396 |
predictions = fetch_latest_predictions(match_id)
|
| 397 |
|
| 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")
|
|
@@ -404,13 +405,18 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
|
|
| 404 |
|
| 405 |
# Directly update or add the match outcome
|
| 406 |
outcome_exists = False
|
| 407 |
-
for outcome in
|
| 408 |
if outcome['match_id'] == match_id:
|
| 409 |
-
|
|
|
|
| 410 |
outcome_exists = True
|
| 411 |
break
|
| 412 |
if not outcome_exists:
|
| 413 |
-
outcomes.add_item({"match_id": match_id, "winning_team": winning_team, "man_of_the_match": man_of_the_match})
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
|
| 415 |
# Update user points based on prediction accuracy
|
| 416 |
for idx, prediction in predictions.iterrows():
|
|
|
|
| 396 |
predictions = fetch_latest_predictions(match_id)
|
| 397 |
|
| 398 |
outcomes = load_dataset("Jay-Rajput/DIS_IPL_Outcomes", split="train") # Load existing match outcomes
|
| 399 |
+
outcomes_df = pd.DataFrame(outcomes)
|
| 400 |
|
| 401 |
# Load existing match outcomes and user data from the test split
|
| 402 |
users = load_dataset("Jay-Rajput/DIS_IPL_Leads", split="train")
|
|
|
|
| 405 |
|
| 406 |
# Directly update or add the match outcome
|
| 407 |
outcome_exists = False
|
| 408 |
+
for idx, outcome in outcomes_df.iterrows():
|
| 409 |
if outcome['match_id'] == match_id:
|
| 410 |
+
outcomes_df.at[idx, 'winning_team'] = winning_team
|
| 411 |
+
outcomes_df.at[idx, 'man_of_the_match'] = man_of_the_match
|
| 412 |
outcome_exists = True
|
| 413 |
break
|
| 414 |
if not outcome_exists:
|
| 415 |
+
# outcomes.add_item({"match_id": match_id, "winning_team": winning_team, "man_of_the_match": man_of_the_match})
|
| 416 |
+
new_outcome = {"match_id": match_id, "winning_team": winning_team, "man_of_the_match": man_of_the_match}
|
| 417 |
+
# Append the new outcome to the DataFrame
|
| 418 |
+
outcomes_df = outcomes_df.append(new_outcome, ignore_index=True)
|
| 419 |
+
outcomes = Dataset.from_pandas(outcomes_df)
|
| 420 |
|
| 421 |
# Update user points based on prediction accuracy
|
| 422 |
for idx, prediction in predictions.iterrows():
|
leaders/users.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"Arpit":{"0":
|
|
|
|
| 1 |
+
{"Arpit":{"0":28015},"Ganesh":{"0":10251},"Haaris":{"0":25300},"Jay":{"0":11500},"Kishore":{"0":12520},"Megha":{"0":18650},"Naveein":{"0":14700},"Neha":{"0":7500},"Praveen":{"0":20800},"Rakesh":{"0":4820},"Sai":{"0":23884},"Sahil":{"0":21880},"Sunil":{"0":4513},"Vaibhav":{"0":6318},"Vinay":{"0":17720}}
|
match_outcomes.json
CHANGED
|
@@ -103,5 +103,55 @@
|
|
| 103 |
"match_id": "20240407_21",
|
| 104 |
"winning_team": "LSG",
|
| 105 |
"man_of_the_match": "Yash Thakur"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
]
|
|
|
|
| 103 |
"match_id": "20240407_21",
|
| 104 |
"winning_team": "LSG",
|
| 105 |
"man_of_the_match": "Yash Thakur"
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"match_id": "20240408_22",
|
| 109 |
+
"winning_team": "CSK",
|
| 110 |
+
"man_of_the_match": "Ravindra Jadeja"
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"match_id": "20240409_23",
|
| 114 |
+
"winning_team": "SRH",
|
| 115 |
+
"man_of_the_match": "Nitish Kumar Reddy"
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"match_id": "20240410_24",
|
| 119 |
+
"winning_team": "GT",
|
| 120 |
+
"man_of_the_match": "Rashid Khan"
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"match_id": "20240411_25",
|
| 124 |
+
"winning_team": "MI",
|
| 125 |
+
"man_of_the_match": "Jasprit Bumrah"
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"match_id": "20240412_26",
|
| 129 |
+
"winning_team": "DC",
|
| 130 |
+
"man_of_the_match": "Kuldeep Yadav"
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"match_id": "20240413_27",
|
| 134 |
+
"winning_team": "RR",
|
| 135 |
+
"man_of_the_match": "Shimron Hetmyer"
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"match_id": "20240414_28",
|
| 139 |
+
"winning_team": "KKR",
|
| 140 |
+
"man_of_the_match": "Phil Salt"
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"match_id": "20240414_29",
|
| 144 |
+
"winning_team": "CSK",
|
| 145 |
+
"man_of_the_match": "Matheesha Pathirana"
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"match_id": "20240415_30",
|
| 149 |
+
"winning_team": "SRH",
|
| 150 |
+
"man_of_the_match": "Travis Head"
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"match_id": "20240416_31",
|
| 154 |
+
"winning_team": "RR",
|
| 155 |
+
"man_of_the_match": "Jos Buttler"
|
| 156 |
}
|
| 157 |
]
|
matches.json
CHANGED
|
@@ -213,15 +213,15 @@
|
|
| 213 |
"match_id": "20240416_31",
|
| 214 |
"date": "2024-04-16",
|
| 215 |
"time": "7:30 PM",
|
| 216 |
-
"teams": ["
|
| 217 |
-
"venue": "
|
| 218 |
},
|
| 219 |
{
|
| 220 |
"match_id": "20240417_32",
|
| 221 |
"date": "2024-04-17",
|
| 222 |
"time": "7:30 PM",
|
| 223 |
-
"teams": ["
|
| 224 |
-
"venue": "
|
| 225 |
},
|
| 226 |
{
|
| 227 |
"match_id": "20240418_33",
|
|
|
|
| 213 |
"match_id": "20240416_31",
|
| 214 |
"date": "2024-04-16",
|
| 215 |
"time": "7:30 PM",
|
| 216 |
+
"teams": ["KKR", "RR"],
|
| 217 |
+
"venue": "Kolkata"
|
| 218 |
},
|
| 219 |
{
|
| 220 |
"match_id": "20240417_32",
|
| 221 |
"date": "2024-04-17",
|
| 222 |
"time": "7:30 PM",
|
| 223 |
+
"teams": ["GT", "DC"],
|
| 224 |
+
"venue": "Ahmedabad"
|
| 225 |
},
|
| 226 |
{
|
| 227 |
"match_id": "20240418_33",
|
outcomes/match_outcomes.json
CHANGED
|
@@ -103,5 +103,55 @@
|
|
| 103 |
"match_id": "20240407_21",
|
| 104 |
"winning_team": "LSG",
|
| 105 |
"man_of_the_match": "Yash Thakur"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
}
|
| 107 |
]
|
|
|
|
| 103 |
"match_id": "20240407_21",
|
| 104 |
"winning_team": "LSG",
|
| 105 |
"man_of_the_match": "Yash Thakur"
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"match_id": "20240408_22",
|
| 109 |
+
"winning_team": "CSK",
|
| 110 |
+
"man_of_the_match": "Ravindra Jadeja"
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"match_id": "20240409_23",
|
| 114 |
+
"winning_team": "SRH",
|
| 115 |
+
"man_of_the_match": "Nitish Kumar Reddy"
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"match_id": "20240410_24",
|
| 119 |
+
"winning_team": "GT",
|
| 120 |
+
"man_of_the_match": "Rashid Khan"
|
| 121 |
+
},
|
| 122 |
+
{
|
| 123 |
+
"match_id": "20240411_25",
|
| 124 |
+
"winning_team": "MI",
|
| 125 |
+
"man_of_the_match": "Jasprit Bumrah"
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"match_id": "20240412_26",
|
| 129 |
+
"winning_team": "DC",
|
| 130 |
+
"man_of_the_match": "Kuldeep Yadav"
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"match_id": "20240413_27",
|
| 134 |
+
"winning_team": "RR",
|
| 135 |
+
"man_of_the_match": "Shimron Hetmyer"
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"match_id": "20240414_28",
|
| 139 |
+
"winning_team": "KKR",
|
| 140 |
+
"man_of_the_match": "Phil Salt"
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"match_id": "20240414_29",
|
| 144 |
+
"winning_team": "CSK",
|
| 145 |
+
"man_of_the_match": "Matheesha Pathirana"
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"match_id": "20240415_30",
|
| 149 |
+
"winning_team": "SRH",
|
| 150 |
+
"man_of_the_match": "Travis Head"
|
| 151 |
+
},
|
| 152 |
+
{
|
| 153 |
+
"match_id": "20240416_31",
|
| 154 |
+
"winning_team": "RR",
|
| 155 |
+
"man_of_the_match": "Jos Buttler"
|
| 156 |
}
|
| 157 |
]
|
users.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"Arpit":{"0":
|
|
|
|
| 1 |
+
{"Arpit":{"0":28015},"Ganesh":{"0":10251},"Haaris":{"0":25300},"Jay":{"0":11500},"Kishore":{"0":12520},"Megha":{"0":18650},"Naveein":{"0":14700},"Neha":{"0":7500},"Praveen":{"0":20800},"Rakesh":{"0":4820},"Sai":{"0":23884},"Sahil":{"0":21880},"Sunil":{"0":4513},"Vaibhav":{"0":6318},"Vinay":{"0":17720}}
|