Spaces:
Runtime error
Runtime error
Update create_results.py
Browse files- create_results.py +19 -2
create_results.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
import os
|
2 |
import sys
|
3 |
-
|
4 |
from huggingface_hub import HfApi
|
|
|
5 |
|
6 |
TOKEN = os.environ.get("DEBUG")
|
7 |
|
@@ -9,8 +10,24 @@ api = HfApi(token=TOKEN)
|
|
9 |
|
10 |
out_dir = sys.argv[1]
|
11 |
|
|
|
12 |
api.upload_folder(
|
13 |
folder_path=out_dir,
|
14 |
repo_id="EnergyStarAI/results_debug",
|
15 |
repo_type="dataset",
|
16 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
import sys
|
3 |
+
from datasets import load_dataset, Dataset
|
4 |
from huggingface_hub import HfApi
|
5 |
+
import pandas as pd
|
6 |
|
7 |
TOKEN = os.environ.get("DEBUG")
|
8 |
|
|
|
10 |
|
11 |
out_dir = sys.argv[1]
|
12 |
|
13 |
+
#Uploading results
|
14 |
api.upload_folder(
|
15 |
folder_path=out_dir,
|
16 |
repo_id="EnergyStarAI/results_debug",
|
17 |
repo_type="dataset",
|
18 |
+
)
|
19 |
+
|
20 |
+
|
21 |
+
#Updating requests
|
22 |
+
requests = load_dataset("EnergyStarAI/requests_debug", split="test", token=TOKEN)
|
23 |
+
requests_dset = requests.to_pandas()
|
24 |
+
|
25 |
+
models_ran=[]
|
26 |
+
for dir, path, files in os.walk(out_dir):
|
27 |
+
for fid in files:
|
28 |
+
model = os.path.join(dir, fid)
|
29 |
+
models_ran.append(model)
|
30 |
+
|
31 |
+
requests_dset.loc[requests_dset["model"].isin(models_ran), ['status']] = "COMPLETED"
|
32 |
+
updated_dset =Dataset.from_pandas(requests_dset)
|
33 |
+
updated_dset.push_to_hub("EnergyStarAI/requests_debug", split="test", token=TOKEN)
|