Spaces:
Sleeping
Sleeping
Download openmodellab/reporting/json_writer.py from ajaygovind/OpenModelLab: direct link, hf CLI and curl.
- Browser
- Download file 383 Bytes
-
https://huggingface.co/spaces/ajaygovind/OpenModelLab/resolve/main/openmodellab/reporting/json_writer.py
- Command line
-
hf download hf://spaces/ajaygovind/OpenModelLab/openmodellab/reporting/json_writer.py
-
curl -L -o json_writer.py https://huggingface.co/spaces/ajaygovind/OpenModelLab/resolve/main/openmodellab/reporting/json_writer.py
383 Bytes
| import json | |
| from pathlib import Path | |
| def save_json(report: dict, model_name: str): | |
| model_dir = model_name.replace("/", "_") | |
| out_dir = Path("outputs") / model_dir | |
| out_dir.mkdir(parents=True, exist_ok=True) | |
| output_file = out_dir / "genome.json" | |
| with open(output_file, "w", encoding="utf-8") as f: | |
| json.dump(report, f, indent=2) | |
| return output_file | |