Spaces:
Runtime error
Runtime error
meg-huggingface
commited on
Commit
·
f470e32
1
Parent(s):
8e34882
Removing local .cache directory from snapshot_download
Browse files- parse_requests.py +9 -10
parse_requests.py
CHANGED
@@ -3,7 +3,7 @@ from huggingface_hub import snapshot_download
|
|
3 |
import json
|
4 |
|
5 |
TOKEN = os.environ.get("DEBUG")
|
6 |
-
requests_dataset = snapshot_download('EnergyStarAI/requests_debug', token=TOKEN, repo_type="dataset")
|
7 |
|
8 |
def normalize_task(task):
|
9 |
# Makes assumption about how the task names are being written, and called.
|
@@ -12,12 +12,11 @@ def normalize_task(task):
|
|
12 |
|
13 |
for dir, path, files in os.walk(requests_dataset):
|
14 |
for fid in files:
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
print("%s,%s" % (model, task))
|
|
|
3 |
import json
|
4 |
|
5 |
TOKEN = os.environ.get("DEBUG")
|
6 |
+
requests_dataset = snapshot_download('EnergyStarAI/requests_debug', token=TOKEN, repo_type="dataset", allow_patterns="*.json")
|
7 |
|
8 |
def normalize_task(task):
|
9 |
# Makes assumption about how the task names are being written, and called.
|
|
|
12 |
|
13 |
for dir, path, files in os.walk(requests_dataset):
|
14 |
for fid in files:
|
15 |
+
file_path = os.path.join(dir, fid)
|
16 |
+
with open(file_path) as fp:
|
17 |
+
request = json.load(fp)
|
18 |
+
status = request['status']
|
19 |
+
if status == 'PENDING':
|
20 |
+
model = request['model']
|
21 |
+
task = normalize_task(request['task'])
|
22 |
+
print("%s,%s" % (model, task))
|
|