jarajpu commited on
Commit
82f926c
·
1 Parent(s): 4c974b2

Updating repo for leads

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -291,7 +291,7 @@ def display_leaderboard():
291
  # if st.button("Show Leaderboard"):
292
  # try:
293
  # # Load the 'leaders' configuration or split from your dataset
294
- # dataset = load_dataset("Jay-Rajput/DIS_IPL_Dataset", "leaders", split='train')
295
  # # Convert the dataset to a pandas DataFrame
296
  # df_users = pd.DataFrame(dataset)
297
 
@@ -383,7 +383,7 @@ ADMIN_PASSPHRASE = "admin123"
383
 
384
  def fetch_latest_predictions(match_id):
385
  # Load the dataset. Adjust "split" to "train" or appropriate if "predictions" is a configuration.
386
- dataset = load_dataset("Jay-Rajput/DIS_IPL_Preds")
387
 
388
  # Convert the dataset to a pandas DataFrame
389
  df = pd.DataFrame(dataset)
@@ -412,7 +412,7 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
412
 
413
  outcomes = load_data(OUTCOMES_JSON) # Load existing match outcomes
414
  # Load existing match outcomes and user data from the test split
415
- dataset = load_dataset("Jay-Rajput/DIS_IPL_Leads")
416
  users = pd.DataFrame(dataset)
417
 
418
  # Directly update or add the match outcome
@@ -435,7 +435,7 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
435
  # Update points based on prediction accuracy
436
  if predicted_winner == winning_team:
437
  users[user_name] += 1000
438
- users[user_name] += bid_points
439
  if predicted_motm == man_of_the_match:
440
  users[user_name] += 400 # Bonus for both correct predictions
441
  else:
@@ -445,7 +445,7 @@ def update_leaderboard_and_outcomes(match_id, winning_team, man_of_the_match):
445
  users.to_json(USERS_JSON)
446
  # Convert the updated DataFrame back to a Hugging Face Dataset and push updates
447
  updated_dataset = Dataset.from_pandas(users)
448
- updated_dataset.push_to_hub("Jay-Rajput/DIS_IPL_Leads")
449
 
450
 
451
  with st.sidebar:
 
291
  # if st.button("Show Leaderboard"):
292
  # try:
293
  # # Load the 'leaders' configuration or split from your dataset
294
+ # dataset = load_dataset("Jay-Rajput/DIS_IPL_Leads", split='train')
295
  # # Convert the dataset to a pandas DataFrame
296
  # df_users = pd.DataFrame(dataset)
297
 
 
383
 
384
  def fetch_latest_predictions(match_id):
385
  # Load the dataset. Adjust "split" to "train" or appropriate if "predictions" is a configuration.
386
+ dataset = load_dataset("Jay-Rajput/DIS_IPL_Preds", split="train")
387
 
388
  # Convert the dataset to a pandas DataFrame
389
  df = pd.DataFrame(dataset)
 
412
 
413
  outcomes = load_data(OUTCOMES_JSON) # Load existing match outcomes
414
  # Load existing match outcomes and user data from the test split
415
+ dataset = load_dataset("Jay-Rajput/DIS_IPL_Leads", split="train")
416
  users = pd.DataFrame(dataset)
417
 
418
  # Directly update or add the match outcome
 
435
  # Update points based on prediction accuracy
436
  if predicted_winner == winning_team:
437
  users[user_name] += 1000
438
+ users[user_name] += bid_points
439
  if predicted_motm == man_of_the_match:
440
  users[user_name] += 400 # Bonus for both correct predictions
441
  else:
 
445
  users.to_json(USERS_JSON)
446
  # Convert the updated DataFrame back to a Hugging Face Dataset and push updates
447
  updated_dataset = Dataset.from_pandas(users)
448
+ updated_dataset.push_to_hub("Jay-Rajput/DIS_IPL_Leads", split="train")
449
 
450
 
451
  with st.sidebar: