rbiswasfc commited on
Commit
a09f74e
·
1 Parent(s): aff259f
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. .gitignore +1 -0
  3. app.py +22 -5
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ .sesskey
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .sesskey
app.py CHANGED
@@ -1,14 +1,14 @@
1
  import json
 
2
  import random
3
  from collections import Counter
4
 
5
- import dotenv
6
- from datasets import load_dataset
7
  from fasthtml.common import *
8
- from fasthtml_hf import setup_hf_backup
9
  from fastlite import database
 
10
 
11
- dotenv.load_dotenv()
12
 
13
  fact_dataset = load_dataset("griffin/iclr2025_data_scores", split="train").to_list()
14
  fact_dataset = [{"example_id": i, **example} for i, example in enumerate(fact_dataset)]
@@ -121,6 +121,22 @@ def render_example(example):
121
  )
122
 
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  @rt("/")
125
  async def get(question_type: str = None):
126
  stats = get_stats()
@@ -207,6 +223,7 @@ async def post(decision: str, example: str):
207
  "decision": decision,
208
  }
209
  )
 
210
 
211
  # Add the evaluated example's ID to the set of evaluated IDs
212
  evaluated_ids.add(example_dict["example_id"])
@@ -225,5 +242,5 @@ if __name__ == "__main__":
225
 
226
  import uvicorn
227
 
228
- setup_hf_backup(app)
229
  uvicorn.run(app, host="0.0.0.0", port=int(os.environ.get("PORT", 7860)))
 
1
  import json
2
+ import os
3
  import random
4
  from collections import Counter
5
 
6
+ from datasets import Dataset, load_dataset
 
7
  from fasthtml.common import *
 
8
  from fastlite import database
9
+ from huggingface_hub import create_repo, login
10
 
11
+ login(token=os.environ.get("HF_TOKEN"))
12
 
13
  fact_dataset = load_dataset("griffin/iclr2025_data_scores", split="train").to_list()
14
  fact_dataset = [{"example_id": i, **example} for i, example in enumerate(fact_dataset)]
 
121
  )
122
 
123
 
124
+ def upload_to_hf():
125
+ create_repo(
126
+ repo_id="rbiswasfc/iclr-eval-examples",
127
+ token=os.environ.get("HF_TOKEN"),
128
+ private=True,
129
+ repo_type="dataset",
130
+ exist_ok=True,
131
+ )
132
+
133
+ examples = db.t.examples
134
+ annotations = examples()
135
+
136
+ hf_ds = Dataset.from_list(annotations)
137
+ hf_ds.push_to_hub("rbiswasfc/iclr-eval-examples", token=os.environ.get("HF_TOKEN"))
138
+
139
+
140
  @rt("/")
141
  async def get(question_type: str = None):
142
  stats = get_stats()
 
223
  "decision": decision,
224
  }
225
  )
226
+ upload_to_hf()
227
 
228
  # Add the evaluated example's ID to the set of evaluated IDs
229
  evaluated_ids.add(example_dict["example_id"])
 
242
 
243
  import uvicorn
244
 
245
+ # setup_hf_backup(app)
246
  uvicorn.run(app, host="0.0.0.0", port=int(os.environ.get("PORT", 7860)))