Spaces:
Runtime error
Runtime error
Download agent_threat_map/loader.py from obversarystudios/agent-threat-map: direct link, hf CLI and curl.
- Browser
- Download file 572 Bytes
-
https://huggingface.co/spaces/obversarystudios/agent-threat-map/resolve/main/agent_threat_map/loader.py
- Command line
-
hf download hf://spaces/obversarystudios/agent-threat-map/agent_threat_map/loader.py
-
curl -L -o loader.py https://huggingface.co/spaces/obversarystudios/agent-threat-map/resolve/main/agent_threat_map/loader.py
572 Bytes
| from __future__ import annotations | |
| import json | |
| from pathlib import Path | |
| from agent_threat_map.schema import Probe | |
| def load_probes(path: str | Path) -> list[Probe]: | |
| path = Path(path) | |
| probes: list[Probe] = [] | |
| with path.open(encoding="utf-8") as f: | |
| for line in f: | |
| line = line.strip() | |
| if not line: | |
| continue | |
| probes.append(Probe.from_dict(json.loads(line))) | |
| return probes | |
| def load_categories(path: str | Path) -> dict: | |
| with Path(path).open(encoding="utf-8") as f: | |
| return json.load(f) | |