datakomarov commited on
Commit
c2f2cb1
·
verified ·
1 Parent(s): 58c57fb

use space for LB, update LB

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -8,7 +8,7 @@ from src.submission.check_validity import check_submission
8
  from src.submission.submit import evaluate_submission
9
  from src.envs import load_jsonl, CORPUS_PATH
10
 
11
- from huggingface_hub import hf_hub_download
12
 
13
  HF_TOKEN = os.getenv("HF_TOKEN")
14
 
@@ -16,7 +16,7 @@ LEADERBOARD_PATH = "leaderboard.csv"
16
 
17
  # Download from a dataset
18
 
19
- hf_hub_download(repo_id="datakomarov/RAG-data", filename="leaderboard.csv", repo_type="dataset", token=HF_TOKEN, local_dir=".")
20
 
21
  LB_COLUMNS = [
22
  "timestamp", "username", "team", "commit",
@@ -114,6 +114,14 @@ def submit_file(file_obj, username, team, commit):
114
  df.to_csv(LEADERBOARD_PATH, index=False)
115
  df = sort_leaderboard(df)
116
 
 
 
 
 
 
 
 
 
117
  summary = (
118
  f"✅ Submitted! "
119
  f"N={row['n']} | 0:{row['Answer not accepted']} 1:{row['Some truth']} 2:{row['Accepted answer']} | "
 
8
  from src.submission.submit import evaluate_submission
9
  from src.envs import load_jsonl, CORPUS_PATH
10
 
11
+ from huggingface_hub import hf_hub_download, HfApi
12
 
13
  HF_TOKEN = os.getenv("HF_TOKEN")
14
 
 
16
 
17
  # Download from a dataset
18
 
19
+ hf_hub_download(repo_id="datakomarov/RAG-LB", filename="leaderboard.csv", repo_type="space", token=HF_TOKEN, local_dir=".")
20
 
21
  LB_COLUMNS = [
22
  "timestamp", "username", "team", "commit",
 
114
  df.to_csv(LEADERBOARD_PATH, index=False)
115
  df = sort_leaderboard(df)
116
 
117
+ api = HfApi()
118
+ api.upload_file(
119
+ path_or_fileobj=LEADERBOARD_PATH,
120
+ path_in_repo=LEADERBOARD_PATH,
121
+ repo_id="datakomarov/RAG-LB",
122
+ repo_type="space",
123
+ )
124
+
125
  summary = (
126
  f"✅ Submitted! "
127
  f"N={row['n']} | 0:{row['Answer not accepted']} 1:{row['Some truth']} 2:{row['Accepted answer']} | "