-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_static_site.py
31 lines (23 loc) · 943 Bytes
/
build_static_site.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import json
from pathlib import Path
# Temporarily disabled from appearing on the board, e.g. if there's still some issues
BLACKLIST = ["yolov9"]
results_list = []
for model_dir in Path("models/object_detection").iterdir():
if model_dir.is_file() or model_dir.name.startswith("_"):
continue
if model_dir.name in BLACKLIST:
continue
for results_file in model_dir.glob("results*.json"):
with open(results_file) as f:
results = json.load(f)
results_list.append(results)
json_results = json.dumps(results_list, indent=2)
js_results = "const results = " + json_results + ";"
# Used to generate programmatic model comparison pages
with open("static/aggregate_results.json", "w") as f:
f.write(json_results)
# Displayed in the table
with open("static/aggregate_results.js", "w") as f:
f.write(js_results)
print("Results aggregated and saved to static/aggregate_results.js")