Spaces:
Sleeping
Sleeping
Download scripts/ask.py from REBELLION2002/traffix-live: direct link, hf CLI and curl.
- Browser
- Download file 552 Bytes
-
https://huggingface.co/spaces/REBELLION2002/traffix-live/resolve/main/scripts/ask.py
- Command line
-
hf download hf://spaces/REBELLION2002/traffix-live/scripts/ask.py
-
curl -L -o ask.py https://huggingface.co/spaces/REBELLION2002/traffix-live/resolve/main/scripts/ask.py
552 Bytes
| """ | |
| Ask the explainer agent (Synapse) about a saved decision log. | |
| python scripts/ask.py results/logs/decisions_traffix_emergency_1.jsonl "Why did ambulance1 get green at F4?" | |
| """ | |
| import sys | |
| import _path # noqa: F401 | |
| from traffix.agents.network.explainer import ExplainerAgent | |
| from traffix.core.decision_log import load | |
| if __name__ == "__main__": | |
| if len(sys.argv) < 3: | |
| print(__doc__) | |
| sys.exit(1) | |
| r = ExplainerAgent(load(sys.argv[1])).ask(" ".join(sys.argv[2:])) | |
| print(f"[{r['engine']}] {r['answer']}") | |