Freddy Boulton commited on
Commit
31d54a4
·
1 Parent(s): 0e24f43
Files changed (3) hide show
  1. app.py +5 -3
  2. constants.py +1 -1
  3. utils.py +1 -2
app.py CHANGED
@@ -76,9 +76,9 @@ def refresh_overall_leaderboard():
76
  return format_leaderboard_table(df_results=current_dataframe)
77
 
78
 
79
- def fetch_latest_data():
80
  import time
81
- while True:
82
  try:
83
  fetch_hf_results()
84
  except Exception as e:
@@ -90,9 +90,11 @@ def fetch_latest_data():
90
  @contextlib.asynccontextmanager
91
  async def periodic_data_fetch(app):
92
  import threading
93
- t = threading.Thread(target=fetch_latest_data, daemon=True)
 
94
  t.start()
95
  yield
 
96
  t.join(3)
97
 
98
 
 
76
  return format_leaderboard_table(df_results=current_dataframe)
77
 
78
 
79
+ def fetch_latest_data(stop_event):
80
  import time
81
+ while not stop_event.is_set():
82
  try:
83
  fetch_hf_results()
84
  except Exception as e:
 
90
  @contextlib.asynccontextmanager
91
  async def periodic_data_fetch(app):
92
  import threading
93
+ event = threading.Event()
94
+ t = threading.Thread(target=fetch_latest_data, args=(event,), daemon=True)
95
  t.start()
96
  yield
97
+ event.set()
98
  t.join(3)
99
 
100
 
constants.py CHANGED
@@ -68,7 +68,7 @@ API = HfApi(token=TOKEN)
68
  # Huggingface repos
69
  ORGANIZATION = "ginkgo-datapoints"
70
  SUBMISSIONS_REPO = f"{ORGANIZATION}/abdev-bench-submissions"
71
- RESULTS_REPO = f"{ORGANIZATION}/abdev-bench-results-test"
72
 
73
  # Leaderboard dataframes
74
  LEADERBOARD_RESULTS_COLUMNS = [
 
68
  # Huggingface repos
69
  ORGANIZATION = "ginkgo-datapoints"
70
  SUBMISSIONS_REPO = f"{ORGANIZATION}/abdev-bench-submissions"
71
+ RESULTS_REPO = f"{ORGANIZATION}/abdev-bench-results"
72
 
73
  # Leaderboard dataframes
74
  LEADERBOARD_RESULTS_COLUMNS = [
utils.py CHANGED
@@ -30,7 +30,7 @@ def fetch_hf_results():
30
  # load_dataset should cache by default if not using force_redownload
31
  df = load_dataset(
32
  RESULTS_REPO,
33
- data_files="data/train-00000-of-00001.parquet",
34
  )["train"].to_pandas()
35
  print("fetched results from HF", df.shape)
36
  assert all(
@@ -56,7 +56,6 @@ def fetch_hf_results():
56
  # Note: Could optionally add a column "is_baseline" to the dataframe to indicate whether the model is a baseline model or not. If things get crowded.
57
  # Anonymize the user column at this point (so note: users can submit anonymous / non-anonymous and we'll show their latest submission regardless)
58
  df.loc[df["anonymous"] != False, "user"] = "anon-" + df.loc[df["anonymous"] != False, "user"].apply(readable_hash)
59
- print("after filtering to latest submissions only", df.shape)
60
  df.to_csv("debug-current-results.csv", index=False)
61
 
62
 
 
30
  # load_dataset should cache by default if not using force_redownload
31
  df = load_dataset(
32
  RESULTS_REPO,
33
+ data_files="auto_submissions/metrics_all.csv",
34
  )["train"].to_pandas()
35
  print("fetched results from HF", df.shape)
36
  assert all(
 
56
  # Note: Could optionally add a column "is_baseline" to the dataframe to indicate whether the model is a baseline model or not. If things get crowded.
57
  # Anonymize the user column at this point (so note: users can submit anonymous / non-anonymous and we'll show their latest submission regardless)
58
  df.loc[df["anonymous"] != False, "user"] = "anon-" + df.loc[df["anonymous"] != False, "user"].apply(readable_hash)
 
59
  df.to_csv("debug-current-results.csv", index=False)
60
 
61