Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -65,14 +65,30 @@ def add_new_eval(
|
|
65 |
|
66 |
upload_data = {}
|
67 |
for file in os.listdir(filename):
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
# add new data
|
77 |
new_data = [
|
78 |
model_name
|
|
|
65 |
|
66 |
upload_data = {}
|
67 |
for file in os.listdir(filename):
|
68 |
+
if file.startswith('.') or file.startswith('__'):
|
69 |
+
print(f"Skip the file: {file}")
|
70 |
+
continue
|
71 |
+
cur_file = os.path.join(filename, file)
|
72 |
+
if os.path.isdir(cur_file):
|
73 |
+
for subfile in os.listdir(cur_file):
|
74 |
+
if file.endswith("json"):
|
75 |
+
with open(os.path.join(cur_file, subfile)) as ff:
|
76 |
+
cur_json = json.load(ff)
|
77 |
+
print(file, type(cur_json))
|
78 |
+
if isinstance(cur_json, dict):
|
79 |
+
print(cur_json.keys())
|
80 |
+
for key in cur_json:
|
81 |
+
upload_data[key.replace('_',' ')] = cur_json[key][0]
|
82 |
+
print(f"{key}:{cur_json[key][0]}")
|
83 |
+
elif cur_file.endswith('json'):
|
84 |
+
with open(cur_file) as ff:
|
85 |
+
cur_json = json.load(ff)
|
86 |
+
print(file, type(cur_json))
|
87 |
+
if isinstance(cur_json, dict):
|
88 |
+
print(cur_json.keys())
|
89 |
+
for key in cur_json:
|
90 |
+
upload_data[key.replace('_',' ')] = cur_json[key][0]
|
91 |
+
print(f"{key}:{cur_json[key][0]}")
|
92 |
# add new data
|
93 |
new_data = [
|
94 |
model_name
|