Spaces:
Sleeping
Sleeping
Commit
·
ce91e2d
1
Parent(s):
b380276
update key for hf token and fix method not found
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ from datetime import datetime
|
|
| 15 |
from pathlib import Path
|
| 16 |
from uuid import uuid4
|
| 17 |
import json
|
| 18 |
-
from huggingface_hub import CommitScheduler
|
| 19 |
|
| 20 |
def main():
|
| 21 |
config = yaml.safe_load(open("config/config.yaml"))
|
|
@@ -135,14 +135,12 @@ def main():
|
|
| 135 |
def redirect():
|
| 136 |
pass
|
| 137 |
|
|
|
|
| 138 |
def save_results(answers):
|
| 139 |
-
api = HfApi()
|
| 140 |
api_token = os.getenv("HUGGINGFACE_TOKEN")
|
| 141 |
if not api_token:
|
| 142 |
raise ValueError("Hugging Face API token not found. Please set the HF_API_TOKEN environment variable.")
|
| 143 |
|
| 144 |
-
api.set_access_token(api_token)
|
| 145 |
-
|
| 146 |
json_file_results = config['results']['exp1_dir'] # 'exp1'
|
| 147 |
JSON_DATASET_DIR = Path("json_dataset")
|
| 148 |
JSON_DATASET_DIR.mkdir(parents=True, exist_ok=True)
|
|
@@ -151,7 +149,8 @@ def main():
|
|
| 151 |
repo_id="example-space-to-dataset-json",
|
| 152 |
repo_type="dataset",
|
| 153 |
folder_path=JSON_DATASET_DIR,
|
| 154 |
-
path_in_repo="data"
|
|
|
|
| 155 |
)
|
| 156 |
|
| 157 |
info_to_push = {
|
|
@@ -169,7 +168,6 @@ def main():
|
|
| 169 |
}, f)
|
| 170 |
f.write("\n")
|
| 171 |
scheduler.push_to_hub()
|
| 172 |
-
|
| 173 |
|
| 174 |
def add_answer(dropdown1,dropdown2,dropdown3,dropdown4, answers):
|
| 175 |
rank = [dropdown1,dropdown2,dropdown3,dropdown4]
|
|
|
|
| 15 |
from pathlib import Path
|
| 16 |
from uuid import uuid4
|
| 17 |
import json
|
| 18 |
+
from huggingface_hub import CommitScheduler
|
| 19 |
|
| 20 |
def main():
|
| 21 |
config = yaml.safe_load(open("config/config.yaml"))
|
|
|
|
| 135 |
def redirect():
|
| 136 |
pass
|
| 137 |
|
| 138 |
+
|
| 139 |
def save_results(answers):
|
|
|
|
| 140 |
api_token = os.getenv("HUGGINGFACE_TOKEN")
|
| 141 |
if not api_token:
|
| 142 |
raise ValueError("Hugging Face API token not found. Please set the HF_API_TOKEN environment variable.")
|
| 143 |
|
|
|
|
|
|
|
| 144 |
json_file_results = config['results']['exp1_dir'] # 'exp1'
|
| 145 |
JSON_DATASET_DIR = Path("json_dataset")
|
| 146 |
JSON_DATASET_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 149 |
repo_id="example-space-to-dataset-json",
|
| 150 |
repo_type="dataset",
|
| 151 |
folder_path=JSON_DATASET_DIR,
|
| 152 |
+
path_in_repo="data",
|
| 153 |
+
token=api_token # Pass the token here
|
| 154 |
)
|
| 155 |
|
| 156 |
info_to_push = {
|
|
|
|
| 168 |
}, f)
|
| 169 |
f.write("\n")
|
| 170 |
scheduler.push_to_hub()
|
|
|
|
| 171 |
|
| 172 |
def add_answer(dropdown1,dropdown2,dropdown3,dropdown4, answers):
|
| 173 |
rank = [dropdown1,dropdown2,dropdown3,dropdown4]
|