csai / code /a1_pipeline /io_utils.py
Mohith202's picture
Add core ROI masks, visualization script, and model profiles
8c5a642
Raw
History Blame Contribute Delete
431 Bytes
"""Simple I/O helpers for A1 bootstrap artifacts."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
def ensure_directory(path: Path) -> Path:
path.mkdir(parents=True, exist_ok=True)
return path
def write_json(path: Path, payload: dict[str, Any]) -> None:
with path.open("w", encoding="utf-8") as handle:
json.dump(payload, handle, indent=2, sort_keys=True)