Spaces:
Sleeping
Sleeping
jarajpu
commited on
Commit
·
ffed1a8
1
Parent(s):
a4c253c
testing app
Browse files- Dockerfile +10 -0
- README copy.md +57 -0
- app.py +409 -0
- dis_predictions.csv +11 -0
- ipl_image.png +0 -0
- match_outcomes.json +27 -0
- matches.json +149 -0
- players.json +273 -0
- predictions.csv +33 -0
- requirements.txt +5 -0
- users.json +17 -0
Dockerfile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
COPY requirements.txt requirements.txt
|
| 6 |
+
RUN pip install -r requirements.txt
|
| 7 |
+
|
| 8 |
+
COPY . .
|
| 9 |
+
|
| 10 |
+
CMD ["streamlit", "run", "app.py"]
|
README copy.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: DIS IPL Predictions
|
| 3 |
+
emoji: 🦀
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.32.2
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: apache-2.0
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# DIS IPL Match Predictions App
|
| 14 |
+
|
| 15 |
+
> "Predict, Compete, and Win 🏏 - Where Every Guess Counts! 🏆"
|
| 16 |
+
|
| 17 |
+
Welcome to the DIS IPL Match Predictions App! This app allows you to predict the outcomes of IPL matches and compete with your colleagues to win exciting prizes.
|
| 18 |
+
|
| 19 |
+
## Getting Started
|
| 20 |
+
|
| 21 |
+
### Prerequisites
|
| 22 |
+
|
| 23 |
+
- Python 3.x installed on your system
|
| 24 |
+
- Git installed on your system
|
| 25 |
+
- Pip package manager
|
| 26 |
+
|
| 27 |
+
### Installation
|
| 28 |
+
|
| 29 |
+
1. Clone this repository to your local machine using Git:
|
| 30 |
+
|
| 31 |
+
```bash
|
| 32 |
+
git clone <repository_url>
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
2. Navigate to the cloned repository directory:
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
cd ipl-match-predictions-app
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
3. Install the required Python dependencies using Pip:
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
pip install -r requirements.txt
|
| 45 |
+
```
|
| 46 |
+
|
| 47 |
+
### Running The APP
|
| 48 |
+
|
| 49 |
+
1. After installing the dependencies, you can run the Streamlit app using the following command:
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
streamlit run app.py
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
2. The app will start running locally and open in your default web browser.
|
| 56 |
+
|
| 57 |
+
Thanks
|
app.py
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import base64
|
| 2 |
+
import io
|
| 3 |
+
import json
|
| 4 |
+
import os
|
| 5 |
+
import uuid
|
| 6 |
+
from datetime import datetime
|
| 7 |
+
|
| 8 |
+
import pandas as pd
|
| 9 |
+
import pytz
|
| 10 |
+
import requests
|
| 11 |
+
import streamlit as st
|
| 12 |
+
from huggingface_hub import CommitScheduler, HfApi
|
| 13 |
+
|
| 14 |
+
# File paths as constants
|
| 15 |
+
PREDICTIONS_CSV = 'dis_predictions.csv'
|
| 16 |
+
PREDICTIONS_FOLDER = "ipl_predictions" # Folder where JSON files are saved locally
|
| 17 |
+
USERS_JSON = 'users.json'
|
| 18 |
+
MATCHES_JSON = 'matches.json'
|
| 19 |
+
OUTCOMES_JSON = 'match_outcomes.json'
|
| 20 |
+
PLAYERS_JSON = 'players.json'
|
| 21 |
+
image_path = 'ipl_image.png'
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Initialize CommitScheduler
|
| 25 |
+
scheduler = CommitScheduler(
|
| 26 |
+
repo_id="Jay-Rajput/DIS_IPL_Dataset",
|
| 27 |
+
repo_type="dataset",
|
| 28 |
+
folder_path="ipl_predictions", # Local folder where predictions are saved temporarily
|
| 29 |
+
path_in_repo="predictions", # Path in dataset repo where predictions will be saved
|
| 30 |
+
every=2, # Push every 240 minutes (4 hours)
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Initialize CSV and JSON files if they don't exist
|
| 35 |
+
def initialize_files():
|
| 36 |
+
# Initialize predictions CSV
|
| 37 |
+
try:
|
| 38 |
+
pd.read_csv(PREDICTIONS_CSV)
|
| 39 |
+
except FileNotFoundError:
|
| 40 |
+
df = pd.DataFrame(columns=['user_name', 'match_id', 'predicted_winner', 'predicted_motm', 'bid_points'])
|
| 41 |
+
df.to_csv(PREDICTIONS_CSV, index=False)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def load_data(file_path):
|
| 45 |
+
"""
|
| 46 |
+
Load data from a JSON or CSV file.
|
| 47 |
+
|
| 48 |
+
Args:
|
| 49 |
+
file_path (str): The path to the file to load.
|
| 50 |
+
|
| 51 |
+
Returns:
|
| 52 |
+
pd.DataFrame or dict: The loaded data.
|
| 53 |
+
"""
|
| 54 |
+
try:
|
| 55 |
+
if file_path.endswith('.json'):
|
| 56 |
+
with open(file_path, 'r') as file:
|
| 57 |
+
return json.load(file)
|
| 58 |
+
elif file_path.endswith('.csv'):
|
| 59 |
+
return pd.read_csv(file_path)
|
| 60 |
+
except FileNotFoundError:
|
| 61 |
+
if file_path.endswith('.json'):
|
| 62 |
+
return {}
|
| 63 |
+
elif file_path.endswith('.csv'):
|
| 64 |
+
return pd.DataFrame()
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def get_base64_of_image(path):
|
| 68 |
+
with open(path, "rb") as image_file:
|
| 69 |
+
return base64.b64encode(image_file.read()).decode()
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# Get today's date in IST to load today's match
|
| 73 |
+
def get_current_date_ist():
|
| 74 |
+
tz_IST = pytz.timezone('Asia/Kolkata')
|
| 75 |
+
datetime_ist = datetime.now(tz_IST)
|
| 76 |
+
return datetime_ist.strftime('%Y-%m-%d')
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
# Function to get matches for today
|
| 80 |
+
def get_today_matches():
|
| 81 |
+
today = get_current_date_ist()
|
| 82 |
+
matches = load_data(MATCHES_JSON)
|
| 83 |
+
today_matches = [match for match in matches if match['date'] == today]
|
| 84 |
+
return today_matches
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
# Function to check if prediction submission is allowed
|
| 88 |
+
def is_submission_allowed(match_id):
|
| 89 |
+
matches = load_data(MATCHES_JSON) # This loads matches correctly with IST times
|
| 90 |
+
|
| 91 |
+
for match in matches:
|
| 92 |
+
if match["match_id"] == match_id:
|
| 93 |
+
# Parse the match start time in IST
|
| 94 |
+
tz_IST = pytz.timezone('Asia/Kolkata')
|
| 95 |
+
match_datetime_str = f'{match["date"]} {match["time"]}'
|
| 96 |
+
# The match time string is like "2024-03-21 7:30 PM"
|
| 97 |
+
match_datetime = datetime.strptime(match_datetime_str, "%Y-%m-%d %I:%M %p")
|
| 98 |
+
match_datetime = tz_IST.localize(match_datetime) # Set the timezone to IST
|
| 99 |
+
|
| 100 |
+
# Get the current time in IST
|
| 101 |
+
current_datetime = datetime.now(tz_IST)
|
| 102 |
+
|
| 103 |
+
if current_datetime > match_datetime:
|
| 104 |
+
return False
|
| 105 |
+
else:
|
| 106 |
+
return True
|
| 107 |
+
return False # If match_id not found, default to False
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def load_predictions(PREDICTIONS_CSV):
|
| 111 |
+
try:
|
| 112 |
+
return pd.read_csv(PREDICTIONS_CSV)
|
| 113 |
+
except FileNotFoundError:
|
| 114 |
+
return pd.DataFrame()
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
# Submit prediction function
|
| 118 |
+
def submit_prediction(
|
| 119 |
+
user_name,
|
| 120 |
+
match_id,
|
| 121 |
+
predicted_winner,
|
| 122 |
+
predicted_motm,
|
| 123 |
+
bid_points,
|
| 124 |
+
max_bid_points
|
| 125 |
+
):
|
| 126 |
+
|
| 127 |
+
# Validation for user selection
|
| 128 |
+
if user_name == "Select a user...":
|
| 129 |
+
st.warning("Please select a valid user.")
|
| 130 |
+
return
|
| 131 |
+
|
| 132 |
+
# Check if prediction submission is allowed for the match
|
| 133 |
+
if not is_submission_allowed(match_id):
|
| 134 |
+
st.error("Prediction submission time has passed. Predictions can't be submitted after match start.")
|
| 135 |
+
return
|
| 136 |
+
|
| 137 |
+
if bid_points > max_bid_points:
|
| 138 |
+
st.error(f"Your bid points exceed the 20% limit of your total points. Maximum allowed bid points: {max_bid_points}")
|
| 139 |
+
return
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
# New: Generate a unique ID for this prediction
|
| 143 |
+
prediction_id = uuid.uuid4().hex
|
| 144 |
+
prediction_date = datetime.now().strftime('%Y-%m-%d')
|
| 145 |
+
|
| 146 |
+
prediction_data = {
|
| 147 |
+
'prediction_id': prediction_id,
|
| 148 |
+
'user_name': user_name,
|
| 149 |
+
'match_id': match_id,
|
| 150 |
+
'predicted_winner': predicted_winner,
|
| 151 |
+
'predicted_motm': predicted_motm,
|
| 152 |
+
'bid_points': bid_points,
|
| 153 |
+
'prediction_date': prediction_date # Include the prediction date
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
# Save prediction to a local JSON file for CommitScheduler to handle
|
| 157 |
+
prediction_file_path = f"{PREDICTIONS_FOLDER}/prediction_{prediction_id}.json"
|
| 158 |
+
with open(prediction_file_path, 'w') as file:
|
| 159 |
+
json.dump(prediction_data, file)
|
| 160 |
+
|
| 161 |
+
st.success("Prediction submitted successfully!")
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def get_user_total_points(user_name):
|
| 165 |
+
users = load_data(USERS_JSON)
|
| 166 |
+
return users.get(user_name, 0)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
# Define the new function
|
| 170 |
+
def calculate_max_bid_points(user_name):
|
| 171 |
+
total_points = get_user_total_points(user_name)
|
| 172 |
+
max_bid_points = int(total_points * 0.20) # 20% of total points
|
| 173 |
+
return max_bid_points
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
def load_users(USERS_JSON):
|
| 177 |
+
try:
|
| 178 |
+
with open(USERS_JSON, 'r') as file:
|
| 179 |
+
return json.load(file)
|
| 180 |
+
except FileNotFoundError:
|
| 181 |
+
return {}
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
def user_selection_and_prediction():
|
| 185 |
+
users = list(load_data(USERS_JSON))
|
| 186 |
+
user_name = st.selectbox("Select User", ["Select a user..."] + users)
|
| 187 |
+
|
| 188 |
+
max_bid_points = None
|
| 189 |
+
if user_name != "Select a user...":
|
| 190 |
+
max_bid_points = calculate_max_bid_points(user_name)
|
| 191 |
+
st.write(f"Maximum bid points you can submit: {max_bid_points}")
|
| 192 |
+
|
| 193 |
+
matches = get_today_matches()
|
| 194 |
+
if matches:
|
| 195 |
+
match_choice = st.selectbox("Select Today's Match", matches, format_func=lambda match: f"{match['teams'][0]} vs {match['teams'][1]}")
|
| 196 |
+
match_id = match_choice['match_id']
|
| 197 |
+
teams = match_choice['teams']
|
| 198 |
+
|
| 199 |
+
predicted_winner = st.selectbox("Predicted Winner", teams)
|
| 200 |
+
|
| 201 |
+
player_list = load_data(PLAYERS_JSON)
|
| 202 |
+
predicted_motm = ""
|
| 203 |
+
if predicted_winner in player_list:
|
| 204 |
+
players = player_list[predicted_winner]
|
| 205 |
+
predicted_motm = st.selectbox("Predicted Man of the Match", players)
|
| 206 |
+
|
| 207 |
+
bid_points = st.number_input("Bid Points", min_value=1, value=100, format="%d")
|
| 208 |
+
|
| 209 |
+
if st.button("Submit Prediction"):
|
| 210 |
+
submit_prediction(user_name, match_id, predicted_winner, predicted_motm, bid_points, max_bid_points)
|
| 211 |
+
else:
|
| 212 |
+
st.write("No matches are scheduled for today.")
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
def display_predictions():
|
| 216 |
+
if st.button("Show Predictions"):
|
| 217 |
+
all_predictions = []
|
| 218 |
+
|
| 219 |
+
# Check if the directory exists
|
| 220 |
+
if not os.path.exists(PREDICTIONS_FOLDER):
|
| 221 |
+
st.write("No predictions directory found.")
|
| 222 |
+
return
|
| 223 |
+
|
| 224 |
+
# List all JSON files in the directory
|
| 225 |
+
for filename in os.listdir(PREDICTIONS_FOLDER):
|
| 226 |
+
if filename.endswith('.json'):
|
| 227 |
+
file_path = os.path.join(PREDICTIONS_FOLDER, filename)
|
| 228 |
+
# Read each JSON file and append its contents to the list
|
| 229 |
+
with open(file_path, 'r') as file:
|
| 230 |
+
prediction = json.load(file)
|
| 231 |
+
all_predictions.append(prediction)
|
| 232 |
+
|
| 233 |
+
# Convert the list of dictionaries to a DataFrame
|
| 234 |
+
predictions_df = pd.DataFrame(all_predictions)
|
| 235 |
+
|
| 236 |
+
predictions_df['prediction_date'] = predictions_df.apply(lambda x: datetime.strptime(x['prediction_date'], '%Y-%m-%d'), axis=1)
|
| 237 |
+
|
| 238 |
+
# Filter for today's predictions
|
| 239 |
+
today_str = datetime.now().strftime('%Y-%m-%d')
|
| 240 |
+
todays_predictions = predictions_df[predictions_df['prediction_date'] == today_str]
|
| 241 |
+
|
| 242 |
+
# Remove the 'prediction_id' column if it exists
|
| 243 |
+
if 'prediction_id' in todays_predictions.columns:
|
| 244 |
+
todays_predictions = todays_predictions.drop(columns=['prediction_id', 'prediction_date'])
|
| 245 |
+
|
| 246 |
+
if not todays_predictions.empty:
|
| 247 |
+
st.dataframe(todays_predictions, hide_index=True)
|
| 248 |
+
else:
|
| 249 |
+
st.write("No predictions for today's matches yet.")
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
def display_leaderboard():
|
| 253 |
+
if st.button("Show Leaderboard"):
|
| 254 |
+
try:
|
| 255 |
+
users = load_users(USERS_JSON)
|
| 256 |
+
leaderboard = sorted(users.items(), key=lambda x: x[1], reverse=True)
|
| 257 |
+
|
| 258 |
+
# Generate a list of dictionaries, each representing a row in the leaderboard
|
| 259 |
+
leaderboard_dicts = [{"Rank": rank+1, "User": user[0], "Points": user[1]}
|
| 260 |
+
for rank, user in enumerate(leaderboard)]
|
| 261 |
+
|
| 262 |
+
# Convert the list of dictionaries to a DataFrame
|
| 263 |
+
df_leaderboard = pd.DataFrame(leaderboard_dicts)
|
| 264 |
+
|
| 265 |
+
st.dataframe(df_leaderboard, hide_index=True)
|
| 266 |
+
except FileNotFoundError:
|
| 267 |
+
st.write("Leaderboard data not available.")
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
# Streamlit UI
|
| 271 |
+
encoded_image = get_base64_of_image(image_path)
|
| 272 |
+
custom_css = f"""
|
| 273 |
+
<style>
|
| 274 |
+
.header {{
|
| 275 |
+
font-size: 50px;
|
| 276 |
+
color: #FFD700; /* Gold */
|
| 277 |
+
text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000; /* Black text shadow */
|
| 278 |
+
text-align: center;
|
| 279 |
+
padding: 10px;
|
| 280 |
+
background-image: url('data:image/png;base64,{encoded_image}');
|
| 281 |
+
background-size: cover;
|
| 282 |
+
}}
|
| 283 |
+
</style>
|
| 284 |
+
"""
|
| 285 |
+
# Apply custom CSS
|
| 286 |
+
st.markdown(custom_css, unsafe_allow_html=True)
|
| 287 |
+
# Use the custom class in a div with your title
|
| 288 |
+
st.markdown('<div class="header">DIS IPL Match Predictions</div>', unsafe_allow_html=True)
|
| 289 |
+
|
| 290 |
+
st.write("🏆 Predict, Compete, and Win 🏏 - Where Every Guess Counts! 🏆")
|
| 291 |
+
|
| 292 |
+
user_guide_content = """
|
| 293 |
+
### 📘 User Guide
|
| 294 |
+
|
| 295 |
+
#### Submitting Predictions
|
| 296 |
+
- **Match Selection**: Choose the match you want to predict from today's available matches.
|
| 297 |
+
- **Team and Player Prediction**: Select the team you predict will win and the "Man of the Match".
|
| 298 |
+
- **Bid Points**: Enter the number of points you wish to bid on your prediction. Remember, the maximum you can bid is capped at 20% of your total points.
|
| 299 |
+
|
| 300 |
+
#### Scoring System
|
| 301 |
+
- **Winning Team Prediction**: Correct predictions earn you 1000 points, while incorrect predictions deduct 200 points.
|
| 302 |
+
- **Man of the Match Prediction**: Correctly predicting the "Man of the Match" awards you 200 points. No penalty for incorrect guesses.
|
| 303 |
+
- **Bonus Points**: An additional 200 points bonus is awarded for getting both the team and "Man of the Match" predictions right.
|
| 304 |
+
|
| 305 |
+
#### Bid Point Constraints
|
| 306 |
+
- You cannot bid more than 20% of your current total points.
|
| 307 |
+
- Bid points will be doubled if your prediction is correct, and deducted if incorrect.
|
| 308 |
+
|
| 309 |
+
#### Rules for Submission
|
| 310 |
+
- Predictions must be submitted before the match starts.
|
| 311 |
+
- Only one prediction per match is allowed.
|
| 312 |
+
- Review your prediction carefully before submission, as it cannot be changed once submitted.
|
| 313 |
+
"""
|
| 314 |
+
|
| 315 |
+
# User Guide as an expander
|
| 316 |
+
with st.expander("User Guide 📘"):
|
| 317 |
+
st.markdown(user_guide_content)
|
| 318 |
+
|
| 319 |
+
with st.expander("Submit Prediction 📝"):
|
| 320 |
+
user_selection_and_prediction()
|
| 321 |
+
|
| 322 |
+
with st.expander("Predictions 🔍"):
|
| 323 |
+
display_predictions()
|
| 324 |
+
|
| 325 |
+
with st.expander("Leaderboard 🏆"):
|
| 326 |
+
display_leaderboard()
|
| 327 |
+
|
| 328 |
+
|
| 329 |
+
############################# Admin Panel ##################################
|
| 330 |
+
ADMIN_PASSPHRASE = "admin123"
|
| 331 |
+
|
| 332 |
+
def save_users(users):
|
| 333 |
+
with open(USERS_JSON, 'w') as file:
|
| 334 |
+
json.dump(users, file, indent=4)
|
| 335 |
+
|
| 336 |
+
|
| 337 |
+
def save_match_outcomes(outcomes):
|
| 338 |
+
with open(OUTCOMES_JSON, 'w') as file:
|
| 339 |
+
json.dump(outcomes, file, indent=4)
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
|
| 343 |
+
outcomes = load_data(OUTCOMES_JSON) # Load existing match outcomes
|
| 344 |
+
predictions = load_predictions(PREDICTIONS_CSV) # Load existing predictions
|
| 345 |
+
users = load_users(USERS_JSON) # Load existing user points
|
| 346 |
+
|
| 347 |
+
# Directly update or add the match outcome
|
| 348 |
+
outcome_exists = False
|
| 349 |
+
for outcome in outcomes:
|
| 350 |
+
if outcome['match_id'] == match_id:
|
| 351 |
+
outcome.update({"winning_team": winning_team, "man_of_the_match": man_of_the_match})
|
| 352 |
+
outcome_exists = True
|
| 353 |
+
break
|
| 354 |
+
if not outcome_exists:
|
| 355 |
+
outcomes.append({"match_id": match_id, "winning_team": winning_team, "man_of_the_match": man_of_the_match})
|
| 356 |
+
|
| 357 |
+
# Update user points based on prediction accuracy
|
| 358 |
+
for _, prediction in predictions.iterrows():
|
| 359 |
+
if prediction['match_id'] == match_id:
|
| 360 |
+
user_name = prediction['user_name']
|
| 361 |
+
users[user_name] = users.get(user_name, 0) # Initialize user points if not present
|
| 362 |
+
|
| 363 |
+
# Update points based on prediction accuracy
|
| 364 |
+
if prediction['predicted_winner'] == winning_team:
|
| 365 |
+
users[user_name] += 1000
|
| 366 |
+
users[user_name] += prediction['bid_points']
|
| 367 |
+
if prediction['predicted_motm'] == man_of_the_match:
|
| 368 |
+
users[user_name] += 400 # Bonus for both correct predictions
|
| 369 |
+
else:
|
| 370 |
+
users[user_name] -= 200 + prediction['bid_points'] # Penalty for wrong team prediction
|
| 371 |
+
|
| 372 |
+
save_match_outcomes(outcomes)
|
| 373 |
+
save_users(users)
|
| 374 |
+
|
| 375 |
+
|
| 376 |
+
with st.sidebar:
|
| 377 |
+
expander = st.expander("Admin Panel", expanded=False)
|
| 378 |
+
admin_pass = expander.text_input("Enter admin passphrase:", type="password", key="admin_pass")
|
| 379 |
+
|
| 380 |
+
if admin_pass == ADMIN_PASSPHRASE:
|
| 381 |
+
expander.success("Authenticated")
|
| 382 |
+
matches = get_today_matches() # This function fetches today's matches
|
| 383 |
+
|
| 384 |
+
# If matches are available, let the admin select one
|
| 385 |
+
if matches:
|
| 386 |
+
match_selection = expander.selectbox("Select Match", matches, format_func=lambda match: f"{match['teams'][0]} vs {match['teams'][1]}", key="match_selection")
|
| 387 |
+
selected_match_id = match_selection['match_id']
|
| 388 |
+
teams = match_selection['teams']
|
| 389 |
+
|
| 390 |
+
# Let admin select the winning team
|
| 391 |
+
winning_team = expander.selectbox("Winning Team", teams, key="winning_team")
|
| 392 |
+
|
| 393 |
+
# Fetch and display players for the selected winning team
|
| 394 |
+
player_list = load_data(PLAYERS_JSON)
|
| 395 |
+
if winning_team in player_list:
|
| 396 |
+
players = player_list[winning_team]
|
| 397 |
+
man_of_the_match = expander.selectbox("Man of the Match", players, key="man_of_the_match")
|
| 398 |
+
else:
|
| 399 |
+
players = []
|
| 400 |
+
man_of_the_match = expander.text_input("Man of the Match (Type if not listed)", key="man_of_the_match_fallback")
|
| 401 |
+
|
| 402 |
+
if expander.button("Submit Match Outcome", key="submit_outcome"):
|
| 403 |
+
update_leaderboard_and_outcomes(selected_match_id, winning_team, man_of_the_match)
|
| 404 |
+
expander.success("Match outcome submitted and leaderboard updated!")
|
| 405 |
+
else:
|
| 406 |
+
expander.write("No matches are available for today.")
|
| 407 |
+
else:
|
| 408 |
+
if admin_pass: # Show error only if something was typed
|
| 409 |
+
expander.error("Not authenticated")
|
dis_predictions.csv
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
user_name,match_id,predicted_winner,predicted_motm,bid_points
|
| 2 |
+
Sunil,20240325_6,RCB,Glenn Maxwell,900
|
| 3 |
+
Sahil,20240325_6,RCB,Virat Kohli,350
|
| 4 |
+
Vinay,20240325_6,RCB,Faf du Plessis,200
|
| 5 |
+
Megha,20240325_6,RCB,Virat Kohli,500
|
| 6 |
+
Jay,20240325_6,RCB,Virat Kohli,200
|
| 7 |
+
Sai,20240325_6,RCB,Glenn Maxwell,620
|
| 8 |
+
Haaris,20240325_6,RCB,Virat Kohli,1200
|
| 9 |
+
Naveein,20240325_6,RCB,Faf du Plessis,500
|
| 10 |
+
Praveen,20240325_6,RCB,Faf du Plessis,1800
|
| 11 |
+
Kishore,20240325_6,RCB,Glenn Maxwell,500
|
ipl_image.png
ADDED
|
match_outcomes.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"match_id": "20240322_1",
|
| 4 |
+
"winning_team": "CSK",
|
| 5 |
+
"man_of_the_match": "Mustafizur Rahman"
|
| 6 |
+
},
|
| 7 |
+
{
|
| 8 |
+
"match_id": "20240323_2",
|
| 9 |
+
"winning_team": "PBKS",
|
| 10 |
+
"man_of_the_match": "Sam Curran"
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"match_id": "20240323_3",
|
| 14 |
+
"winning_team": "KKR",
|
| 15 |
+
"man_of_the_match": "Andre Russell"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"match_id": "20240324_4",
|
| 19 |
+
"winning_team": "RR",
|
| 20 |
+
"man_of_the_match": "Sanju Samson"
|
| 21 |
+
},
|
| 22 |
+
{
|
| 23 |
+
"match_id": "20240324_5",
|
| 24 |
+
"winning_team": "GT",
|
| 25 |
+
"man_of_the_match": "B Sai Sudharsan"
|
| 26 |
+
}
|
| 27 |
+
]
|
matches.json
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"match_id": "20240322_1",
|
| 4 |
+
"date": "2024-03-22",
|
| 5 |
+
"time": "7:30 PM",
|
| 6 |
+
"teams": ["CSK", "RCB"],
|
| 7 |
+
"venue": "Chennai"
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"match_id": "20240323_2",
|
| 11 |
+
"date": "2024-03-23",
|
| 12 |
+
"time": "3:30 PM",
|
| 13 |
+
"teams": ["PBKS", "DC"],
|
| 14 |
+
"venue": "Mohali"
|
| 15 |
+
},
|
| 16 |
+
{
|
| 17 |
+
"match_id": "20240323_3",
|
| 18 |
+
"date": "2024-03-23",
|
| 19 |
+
"time": "7:30 PM",
|
| 20 |
+
"teams": ["KKR", "SRH"],
|
| 21 |
+
"venue": "Kolkata"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"match_id": "20240324_4",
|
| 25 |
+
"date": "2024-03-24",
|
| 26 |
+
"time": "3:30 PM",
|
| 27 |
+
"teams": ["RR", "LSG"],
|
| 28 |
+
"venue": "Jaipur"
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"match_id": "20240324_5",
|
| 32 |
+
"date": "2024-03-24",
|
| 33 |
+
"time": "7:30 PM",
|
| 34 |
+
"teams": ["GT", "MI"],
|
| 35 |
+
"venue": "Ahmedabad"
|
| 36 |
+
},
|
| 37 |
+
{
|
| 38 |
+
"match_id": "20240325_6",
|
| 39 |
+
"date": "2024-03-25",
|
| 40 |
+
"time": "7:30 PM",
|
| 41 |
+
"teams": ["RCB", "PBKS"],
|
| 42 |
+
"venue": "Bengaluru"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"match_id": "20240326_7",
|
| 46 |
+
"date": "2024-03-26",
|
| 47 |
+
"time": "7:30 PM",
|
| 48 |
+
"teams": ["CSK", "GT"],
|
| 49 |
+
"venue": "Chennai"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"match_id": "20240327_8",
|
| 53 |
+
"date": "2024-03-27",
|
| 54 |
+
"time": "7:30 PM",
|
| 55 |
+
"teams": ["SRH", "MI"],
|
| 56 |
+
"venue": "Hyderabad"
|
| 57 |
+
},
|
| 58 |
+
{
|
| 59 |
+
"match_id": "20240328_9",
|
| 60 |
+
"date": "2024-03-28",
|
| 61 |
+
"time": "7:30 PM",
|
| 62 |
+
"teams": ["RR", "DC"],
|
| 63 |
+
"venue": "Jaipur"
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"match_id": "20240329_10",
|
| 67 |
+
"date": "2024-03-29",
|
| 68 |
+
"time": "7:30 PM",
|
| 69 |
+
"teams": ["RCB", "KKR"],
|
| 70 |
+
"venue": "Bengaluru"
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"match_id": "20240330_11",
|
| 74 |
+
"date": "2024-03-30",
|
| 75 |
+
"time": "7:30 PM",
|
| 76 |
+
"teams": ["LSG", "PBKS"],
|
| 77 |
+
"venue": "Lucknow"
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"match_id": "20240331_12",
|
| 81 |
+
"date": "2024-03-31",
|
| 82 |
+
"time": "3:30 PM",
|
| 83 |
+
"teams": ["GT", "SRH"],
|
| 84 |
+
"venue": "Ahmedabad"
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"match_id": "20240331_13",
|
| 88 |
+
"date": "2024-03-31",
|
| 89 |
+
"time": "7:30 PM",
|
| 90 |
+
"teams": ["DC", "CSK"],
|
| 91 |
+
"venue": "Visakhapatnam"
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"match_id": "20240401_14",
|
| 95 |
+
"date": "2024-04-01",
|
| 96 |
+
"time": "7:30 PM",
|
| 97 |
+
"teams": ["MI", "RR"],
|
| 98 |
+
"venue": "Mumbai"
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"match_id": "20240402_15",
|
| 102 |
+
"date": "2024-04-02",
|
| 103 |
+
"time": "7:30 PM",
|
| 104 |
+
"teams": ["RCB", "LSG"],
|
| 105 |
+
"venue": "Bengaluru"
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"match_id": "20240403_16",
|
| 109 |
+
"date": "2024-04-03",
|
| 110 |
+
"time": "7:30 PM",
|
| 111 |
+
"teams": ["DC", "KKR"],
|
| 112 |
+
"venue": "Visakhapatnam"
|
| 113 |
+
},
|
| 114 |
+
{
|
| 115 |
+
"match_id": "20240404_17",
|
| 116 |
+
"date": "2024-04-04",
|
| 117 |
+
"time": "7:30 PM",
|
| 118 |
+
"teams": ["GT", "PBKS"],
|
| 119 |
+
"venue": "Ahmedabad"
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"match_id": "20240405_18",
|
| 123 |
+
"date": "2024-04-05",
|
| 124 |
+
"time": "7:30 PM",
|
| 125 |
+
"teams": ["SRH", "CSK"],
|
| 126 |
+
"venue": "Hyderabad"
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"match_id": "20240406_19",
|
| 130 |
+
"date": "2024-04-06",
|
| 131 |
+
"time": "7:30 PM",
|
| 132 |
+
"teams": ["RR", "RCB"],
|
| 133 |
+
"venue": "Jaipur"
|
| 134 |
+
},
|
| 135 |
+
{
|
| 136 |
+
"match_id": "20240407_20",
|
| 137 |
+
"date": "2024-04-07",
|
| 138 |
+
"time": "3:30 PM",
|
| 139 |
+
"teams": ["MI", "DC"],
|
| 140 |
+
"venue": "Mumbai"
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"match_id": "20240407_21",
|
| 144 |
+
"date": "2024-04-07",
|
| 145 |
+
"time": "7:30 PM",
|
| 146 |
+
"teams": ["LSG", "GT"],
|
| 147 |
+
"venue": "Lucknow"
|
| 148 |
+
}
|
| 149 |
+
]
|
players.json
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"CSK": [
|
| 3 |
+
"MS Dhoni",
|
| 4 |
+
"Devon Conway",
|
| 5 |
+
"Ruturaj Gaikwad",
|
| 6 |
+
"Ajinkya Rahane",
|
| 7 |
+
"Shaik Rasheed",
|
| 8 |
+
"Ravindra Jadeja",
|
| 9 |
+
"Mitchell Santner",
|
| 10 |
+
"Moeen Ali",
|
| 11 |
+
"Shivam Dube",
|
| 12 |
+
"Nishant Sindhu",
|
| 13 |
+
"Ajay Mandal",
|
| 14 |
+
"Rajvardhan Hangargekar",
|
| 15 |
+
"Deepak Chahar",
|
| 16 |
+
"Maheesh Theekshana",
|
| 17 |
+
"Mukesh Chowdhary",
|
| 18 |
+
"Prashant Solanki",
|
| 19 |
+
"Simarjeet Singh",
|
| 20 |
+
"Tushar Deshpande",
|
| 21 |
+
"Matheesha Pathirana",
|
| 22 |
+
"Rachin Ravindra",
|
| 23 |
+
"Shardul Thakur",
|
| 24 |
+
"Daryl Mitchell",
|
| 25 |
+
"Sameer Rizvi",
|
| 26 |
+
"Mustafizur Rahman",
|
| 27 |
+
"Avanish Rao Aravelly"
|
| 28 |
+
],
|
| 29 |
+
"DC": [
|
| 30 |
+
"Rishabh Pant",
|
| 31 |
+
"David Warner",
|
| 32 |
+
"Prithvi Shaw",
|
| 33 |
+
"Yash Dhull",
|
| 34 |
+
"Abishek Porel",
|
| 35 |
+
"Axar Patel",
|
| 36 |
+
"Lalit Yadav",
|
| 37 |
+
"Mitchell Marsh",
|
| 38 |
+
"Pravin Dubey",
|
| 39 |
+
"Vicky Ostwal",
|
| 40 |
+
"Anrich Nortje",
|
| 41 |
+
"Kuldeep Yadav",
|
| 42 |
+
"Lungi Ngidi",
|
| 43 |
+
"Khaleel Ahmed",
|
| 44 |
+
"Ishant Sharma",
|
| 45 |
+
"Mukesh Kumar",
|
| 46 |
+
"Harry Brook",
|
| 47 |
+
"Tristan Stubbs",
|
| 48 |
+
"Ricky Bhui",
|
| 49 |
+
"Kumar Kushagra",
|
| 50 |
+
"Rasikh Dar",
|
| 51 |
+
"Jhye Richardson",
|
| 52 |
+
"Sumit Kumar",
|
| 53 |
+
"Shai Hope",
|
| 54 |
+
"Swastik Chhikara",
|
| 55 |
+
"Jake Fraser-McGurk"
|
| 56 |
+
],
|
| 57 |
+
"GT": [
|
| 58 |
+
"David Miller",
|
| 59 |
+
"Shubman Gill",
|
| 60 |
+
"Matthew Wade",
|
| 61 |
+
"Wriddhiman Saha",
|
| 62 |
+
"Kane Williamson",
|
| 63 |
+
"Abhinav Manohar",
|
| 64 |
+
"B Sai Sudharsan",
|
| 65 |
+
"Darshan Nalkande",
|
| 66 |
+
"Vijay Shankar",
|
| 67 |
+
"Jayant Yadav",
|
| 68 |
+
"Rahul Tewatia",
|
| 69 |
+
"Mohammed Shami",
|
| 70 |
+
"Noor Ahmad",
|
| 71 |
+
"R Sai Kishore",
|
| 72 |
+
"Rashid Khan",
|
| 73 |
+
"Josh Little",
|
| 74 |
+
"Mohit Sharma",
|
| 75 |
+
"Azmatullah Omarzai",
|
| 76 |
+
"Umesh Yadav",
|
| 77 |
+
"Shahrukh Khan",
|
| 78 |
+
"Sushant Mishra",
|
| 79 |
+
"Kartik Tyagi",
|
| 80 |
+
"Manav Suthar",
|
| 81 |
+
"Spencer Johnson",
|
| 82 |
+
"Robin Minz"
|
| 83 |
+
],
|
| 84 |
+
"KKR": [
|
| 85 |
+
"Nitish Rana",
|
| 86 |
+
"Rinku Singh",
|
| 87 |
+
"Rahmanullah Gurbaz",
|
| 88 |
+
"Shreyas Iyer",
|
| 89 |
+
"Jason Roy",
|
| 90 |
+
"Anukul Roy",
|
| 91 |
+
"Andre Russell",
|
| 92 |
+
"Venkatesh Iyer",
|
| 93 |
+
"Suyash Sharma",
|
| 94 |
+
"Harshit Rana",
|
| 95 |
+
"Sunil Narine",
|
| 96 |
+
"Vaibhav Arora",
|
| 97 |
+
"Varun Chakravarthy",
|
| 98 |
+
"KS Bharat",
|
| 99 |
+
"Chetan Sakariya",
|
| 100 |
+
"Mitchell Starc",
|
| 101 |
+
"Angkrish Raghuvanshi",
|
| 102 |
+
"Ramandeep Singh",
|
| 103 |
+
"Sherfane Rutherford",
|
| 104 |
+
"Manish Pandey",
|
| 105 |
+
"Mujeeb Ur Rahman",
|
| 106 |
+
"Gus Atkinson",
|
| 107 |
+
"Sakib Hussain",
|
| 108 |
+
"Dushmantha Chameera",
|
| 109 |
+
"Phil Salt"
|
| 110 |
+
],
|
| 111 |
+
"LSG": [
|
| 112 |
+
"KL Rahul",
|
| 113 |
+
"Quinton de Kock",
|
| 114 |
+
"Nicholas Pooran",
|
| 115 |
+
"Ayush Badoni",
|
| 116 |
+
"Deepak Hooda",
|
| 117 |
+
"K Gowtham",
|
| 118 |
+
"Krunal Pandya",
|
| 119 |
+
"Kyle Mayers",
|
| 120 |
+
"Marcus Stoinis",
|
| 121 |
+
"Prerak Mankad",
|
| 122 |
+
"Yudhvir Singh",
|
| 123 |
+
"Mark Wood",
|
| 124 |
+
"Mayank Yadav",
|
| 125 |
+
"Mohsin Khan",
|
| 126 |
+
"Ravi Bishnoi",
|
| 127 |
+
"Yash Thakur",
|
| 128 |
+
"Amit Mishra",
|
| 129 |
+
"Naveen-ul-Haq",
|
| 130 |
+
"Devdutt Padikkal",
|
| 131 |
+
"Shivam Mavi",
|
| 132 |
+
"Arshin Kulkarni",
|
| 133 |
+
"M. Siddharth",
|
| 134 |
+
"Ashton Turner",
|
| 135 |
+
"David Willey",
|
| 136 |
+
"Arshad Khan"
|
| 137 |
+
],
|
| 138 |
+
"MI": [
|
| 139 |
+
"Rohit Sharma",
|
| 140 |
+
"Dewald Brevis",
|
| 141 |
+
"Suryakumar Yadav",
|
| 142 |
+
"Ishan Kishan",
|
| 143 |
+
"Tilak Varma",
|
| 144 |
+
"Tim David",
|
| 145 |
+
"Vishnu Vinod",
|
| 146 |
+
"Arjun Tendulkar",
|
| 147 |
+
"Shams Mulani",
|
| 148 |
+
"Nehal Wadhera",
|
| 149 |
+
"Jasprit Bumrah",
|
| 150 |
+
"Kumar Kartikeya",
|
| 151 |
+
"Piyush Chawla",
|
| 152 |
+
"Akash Madhwal",
|
| 153 |
+
"Jason Behrendorff",
|
| 154 |
+
"Romario Shepherd",
|
| 155 |
+
"Hardik Pandya",
|
| 156 |
+
"Gerald Coetzee",
|
| 157 |
+
"Dilshan Madushanka",
|
| 158 |
+
"Shreyas Gopal",
|
| 159 |
+
"Nuwan Thushara",
|
| 160 |
+
"Naman Dhir",
|
| 161 |
+
"Anshul Kamboj",
|
| 162 |
+
"Mohammad Nabi",
|
| 163 |
+
"Shivalik Sharma",
|
| 164 |
+
"Luke Wood"
|
| 165 |
+
],
|
| 166 |
+
"PBKS": [
|
| 167 |
+
"Shikhar Dhawan",
|
| 168 |
+
"Jitesh Sharma",
|
| 169 |
+
"Jonny Bairstow",
|
| 170 |
+
"Prabhsimran Singh",
|
| 171 |
+
"Liam Livingstone",
|
| 172 |
+
"Matthew Short",
|
| 173 |
+
"Harpreet Bhatia",
|
| 174 |
+
"Atharva Taide",
|
| 175 |
+
"Rishi Dhawan",
|
| 176 |
+
"Sam Curran",
|
| 177 |
+
"Sikandar Raza",
|
| 178 |
+
"Shivam Singh",
|
| 179 |
+
"Harpreet Brar",
|
| 180 |
+
"Arshdeep Singh",
|
| 181 |
+
"Kagiso Rabada",
|
| 182 |
+
"Nathan Ellis",
|
| 183 |
+
"Rahul Chahar",
|
| 184 |
+
"Gurnoor Brar",
|
| 185 |
+
"Vidwath Kaverappa",
|
| 186 |
+
"Harshal Patel",
|
| 187 |
+
"Chris Woakes",
|
| 188 |
+
"Ashutosh Sharma",
|
| 189 |
+
"Vishwanath Pratap Singh",
|
| 190 |
+
"Shashank Singh",
|
| 191 |
+
"Tanay Thyagarajan",
|
| 192 |
+
"Prince Choudhary",
|
| 193 |
+
"Rilee Rossouw"
|
| 194 |
+
],
|
| 195 |
+
"RR": [
|
| 196 |
+
"Sanju Samson",
|
| 197 |
+
"Jos Buttler",
|
| 198 |
+
"Shimron Hetmyer",
|
| 199 |
+
"Yashasvi Jaiswal",
|
| 200 |
+
"Dhruv Jurel",
|
| 201 |
+
"Riyan Parag",
|
| 202 |
+
"Donovan Ferreira",
|
| 203 |
+
"Kunal Rathore",
|
| 204 |
+
"R Ashwin",
|
| 205 |
+
"Kuldeep Sen",
|
| 206 |
+
"Navdeep Saini",
|
| 207 |
+
"Sandeep Sharma",
|
| 208 |
+
"Trent Boult",
|
| 209 |
+
"Yuzvendra Chahal",
|
| 210 |
+
"Adam Zampa",
|
| 211 |
+
"Prasidh Krishna",
|
| 212 |
+
"Avesh Khan",
|
| 213 |
+
"Rovman Powell",
|
| 214 |
+
"Shubham Dubey",
|
| 215 |
+
"Tom Kohler-Cadmore",
|
| 216 |
+
"Abid Mushtaq",
|
| 217 |
+
"Nandre Burger"
|
| 218 |
+
],
|
| 219 |
+
"RCB": [
|
| 220 |
+
"Faf du Plessis",
|
| 221 |
+
"Glenn Maxwell",
|
| 222 |
+
"Virat Kohli",
|
| 223 |
+
"Rajat Patidar",
|
| 224 |
+
"Anuj Rawat",
|
| 225 |
+
"Dinesh Karthik",
|
| 226 |
+
"Suyash Prabhudessai",
|
| 227 |
+
"Will Jacks",
|
| 228 |
+
"Mahipal Lomror",
|
| 229 |
+
"Karn Sharma",
|
| 230 |
+
"Manoj Bhandage",
|
| 231 |
+
"Mayank Dagar",
|
| 232 |
+
"Vyshak Vijaykumar",
|
| 233 |
+
"Akash Deep",
|
| 234 |
+
"Mohammed Siraj",
|
| 235 |
+
"Reece Topley",
|
| 236 |
+
"Himanshu Sharma",
|
| 237 |
+
"Rajan Kumar",
|
| 238 |
+
"Cameron Green",
|
| 239 |
+
"Alzarri Joseph",
|
| 240 |
+
"Yash Dayal",
|
| 241 |
+
"Lockie Ferguson",
|
| 242 |
+
"Tom Curran",
|
| 243 |
+
"Swapnil Singh",
|
| 244 |
+
"Saurav Chauhan"
|
| 245 |
+
],
|
| 246 |
+
"SRH": [
|
| 247 |
+
"Abdul Samad",
|
| 248 |
+
"Aiden Markram",
|
| 249 |
+
"Rahul Tripathi",
|
| 250 |
+
"Glenn Phillips",
|
| 251 |
+
"Mayank Agarwal",
|
| 252 |
+
"Heinrich Klaasen",
|
| 253 |
+
"Anmolpreet Singh",
|
| 254 |
+
"Upendra Yadav",
|
| 255 |
+
"Nitish Kumar Reddy",
|
| 256 |
+
"Abhishek Sharma",
|
| 257 |
+
"Marco Jansen",
|
| 258 |
+
"Washington Sundar",
|
| 259 |
+
"Sanvir Singh",
|
| 260 |
+
"Bhuvneshwar Kumar",
|
| 261 |
+
"Fazalhaq Farooqi",
|
| 262 |
+
"T Natarajan",
|
| 263 |
+
"Umran Malik",
|
| 264 |
+
"Mayank Markande",
|
| 265 |
+
"Shahbaz Ahmed",
|
| 266 |
+
"Travis Head",
|
| 267 |
+
"Wanindu Hasaranga",
|
| 268 |
+
"Pat Cummins",
|
| 269 |
+
"Jaydev Unadkat",
|
| 270 |
+
"Akash Singh",
|
| 271 |
+
"Jhathavedh Subramanyan"
|
| 272 |
+
]
|
| 273 |
+
}
|
predictions.csv
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
user_name,match_id,predicted_winner,predicted_motm,bid_points
|
| 2 |
+
Sahil,20240322_1,CSK,Ruturaj Gaikwad,250
|
| 3 |
+
Naveein,20240322_1,CSK,Rachin Ravindra,1000
|
| 4 |
+
Ganesh,20240322_1,CSK,Ruturaj Gaikwad,300
|
| 5 |
+
Jay,20240322_1,CSK,Ruturaj Gaikwad,500
|
| 6 |
+
Megha,20240322_1,RCB,Virat Kohli,500
|
| 7 |
+
Arpit,20240322_1,CSK,Ravindra Jadeja,1000
|
| 8 |
+
Sunil,20240322_1,RCB,Virat Kohli,299
|
| 9 |
+
Praveen,20240322_1,CSK,Ravindra Jadeja,1000
|
| 10 |
+
Vinay,20240322_1,CSK,Rachin Ravindra,216
|
| 11 |
+
Kichu,20240322_1,CSK,MS Dhoni,500
|
| 12 |
+
Haaris,20240322_1,CSK,MS Dhoni,500
|
| 13 |
+
Rakesh,20240322_1,CSK,MS Dhoni,500
|
| 14 |
+
Megha,20240323_2,DC,Rishabh Pant,200
|
| 15 |
+
Arpit,20240323_2,DC,David Warner,500
|
| 16 |
+
Sahil,20240323_2,DC,Mitchell Marsh,250
|
| 17 |
+
Sai,20240323_2,DC,Rishabh Pant,200
|
| 18 |
+
Neha,20240323_2,DC,Rishabh Pant,500
|
| 19 |
+
Ganesh,20240323_2,DC,Axar Patel,350
|
| 20 |
+
Vinay,20240323_2,DC,David Warner,516
|
| 21 |
+
Megha,20240323_3,KKR,Rinku Singh,200
|
| 22 |
+
Arpit,20240323_3,KKR,Andre Russell,500
|
| 23 |
+
Sahil,20240323_3,KKR,Phil Salt,350
|
| 24 |
+
Sai,20240323_3,SRH,Pat Cummins,300
|
| 25 |
+
Naveein,20240323_3,SRH,Travis Head,500
|
| 26 |
+
Haaris,20240323_3,SRH,Travis Head,300
|
| 27 |
+
Vaibhav,20240323_3,KKR,Mitchell Starc,300
|
| 28 |
+
Neha,20240323_3,KKR,Rinku Singh,300
|
| 29 |
+
Vinay,20240323_3,SRH,Pat Cummins,100
|
| 30 |
+
Sunil,20240325_6,RCB,Glenn Maxwell,900
|
| 31 |
+
Sahil,20240325_6,RCB,Virat Kohli,350
|
| 32 |
+
Vinay,20240325_6,RCB,Faf du Plessis,200
|
| 33 |
+
Megha,20240325_6,RCB,Virat Kohli,500
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
huggingface_hub
|
| 2 |
+
pandas
|
| 3 |
+
pytz
|
| 4 |
+
requests
|
| 5 |
+
streamlit
|
users.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"Arpit": 11300,
|
| 3 |
+
"Ganesh": 5750,
|
| 4 |
+
"Haaris": 6000,
|
| 5 |
+
"Jay": 6500,
|
| 6 |
+
"Kishore": 5700,
|
| 7 |
+
"Megha": 5900,
|
| 8 |
+
"Naveein": 6300,
|
| 9 |
+
"Neha": 5600,
|
| 10 |
+
"Praveen": 9000,
|
| 11 |
+
"Rakesh": 6500,
|
| 12 |
+
"Sai": 3100,
|
| 13 |
+
"Sahil": 6600,
|
| 14 |
+
"Sunil": 4501,
|
| 15 |
+
"Vaibhav": 5600,
|
| 16 |
+
"Vinay": 5300
|
| 17 |
+
}
|