Alina Lozovskaia commited on
Commit
d131b6c
1 Parent(s): b202e95

collection update only happens on full initialization

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -82,10 +82,12 @@ def download_dataset(repo_id, local_dir, repo_type="dataset", max_attempts=3):
82
  def init_space(full_init: bool = True):
83
  """Initializes the application space, loading only necessary data."""
84
  if full_init:
 
85
  download_dataset(QUEUE_REPO, EVAL_REQUESTS_PATH)
86
  download_dataset(DYNAMIC_INFO_REPO, DYNAMIC_INFO_PATH)
87
  download_dataset(RESULTS_REPO, EVAL_RESULTS_PATH)
88
 
 
89
  raw_data, original_df = get_leaderboard_df(
90
  results_path=EVAL_RESULTS_PATH,
91
  requests_path=EVAL_REQUESTS_PATH,
@@ -93,14 +95,18 @@ def init_space(full_init: bool = True):
93
  cols=COLS,
94
  benchmark_cols=BENCHMARK_COLS,
95
  )
96
- update_collections(original_df)
 
 
 
 
97
  leaderboard_df = original_df.copy()
98
 
 
99
  eval_queue_dfs = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
100
 
101
  return leaderboard_df, raw_data, original_df, eval_queue_dfs
102
 
103
-
104
  # Convert the environment variable "LEADERBOARD_FULL_INIT" to a boolean value, defaulting to True if the variable is not set.
105
  # This controls whether a full initialization should be performed.
106
  do_full_init = os.getenv("LEADERBOARD_FULL_INIT", "True") == "True"
 
82
  def init_space(full_init: bool = True):
83
  """Initializes the application space, loading only necessary data."""
84
  if full_init:
85
+ # These downloads only occur on full initialization
86
  download_dataset(QUEUE_REPO, EVAL_REQUESTS_PATH)
87
  download_dataset(DYNAMIC_INFO_REPO, DYNAMIC_INFO_PATH)
88
  download_dataset(RESULTS_REPO, EVAL_RESULTS_PATH)
89
 
90
+ # Always retrieve the leaderboard DataFrame
91
  raw_data, original_df = get_leaderboard_df(
92
  results_path=EVAL_RESULTS_PATH,
93
  requests_path=EVAL_REQUESTS_PATH,
 
95
  cols=COLS,
96
  benchmark_cols=BENCHMARK_COLS,
97
  )
98
+
99
+ if full_init:
100
+ # Collection update only happens on full initialization
101
+ update_collections(original_df)
102
+
103
  leaderboard_df = original_df.copy()
104
 
105
+ # Evaluation queue DataFrame retrieval is independent of initialization detail level
106
  eval_queue_dfs = get_evaluation_queue_df(EVAL_REQUESTS_PATH, EVAL_COLS)
107
 
108
  return leaderboard_df, raw_data, original_df, eval_queue_dfs
109
 
 
110
  # Convert the environment variable "LEADERBOARD_FULL_INIT" to a boolean value, defaulting to True if the variable is not set.
111
  # This controls whether a full initialization should be performed.
112
  do_full_init = os.getenv("LEADERBOARD_FULL_INIT", "True") == "True"