Clémentine commited on
Commit
f62b52e
1 Parent(s): e5885b1

leaderboard using itself as value for update if needed

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -90,11 +90,11 @@ def download_dataset(repo_id, local_dir, repo_type="dataset", max_attempts=3, ba
90
  attempt += 1
91
  raise Exception(f"Failed to download {repo_id} after {max_attempts} attempts")
92
 
93
- def get_latest_data_leaderboard(init: bool = False):
94
  current_time = datetime.datetime.now()
95
  global LAST_UPDATE_LEADERBOARD
96
  if current_time - LAST_UPDATE_LEADERBOARD < datetime.timedelta(minutes=10):
97
- return
98
  LAST_UPDATE_LEADERBOARD = current_time
99
  leaderboard_dataset = datasets.load_dataset(
100
  AGGREGATED_REPO,
@@ -311,7 +311,7 @@ with demo:
311
  show_copy_button=True,
312
  )
313
 
314
- demo.load(fn=get_latest_data_leaderboard, inputs=None, outputs=[leaderboard])
315
  #demo.load(fn=get_latest_data_queue, inputs=None, outputs=[finished_eval_table, running_eval_table, pending_eval_table])
316
 
317
 
 
90
  attempt += 1
91
  raise Exception(f"Failed to download {repo_id} after {max_attempts} attempts")
92
 
93
+ def get_latest_data_leaderboard(leaderboard_initial_df):
94
  current_time = datetime.datetime.now()
95
  global LAST_UPDATE_LEADERBOARD
96
  if current_time - LAST_UPDATE_LEADERBOARD < datetime.timedelta(minutes=10):
97
+ return leaderboard_initial_df
98
  LAST_UPDATE_LEADERBOARD = current_time
99
  leaderboard_dataset = datasets.load_dataset(
100
  AGGREGATED_REPO,
 
311
  show_copy_button=True,
312
  )
313
 
314
+ demo.load(fn=get_latest_data_leaderboard, inputs=[leaderboard], outputs=[leaderboard])
315
  #demo.load(fn=get_latest_data_queue, inputs=None, outputs=[finished_eval_table, running_eval_table, pending_eval_table])
316
 
317