Download agent.py from lablab-ai-amd-developer-hackathon/riprap-nyc: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/riprap-nyc/resolve/main/agent.py
- Command line
-
hf download hf://spaces/lablab-ai-amd-developer-hackathon/riprap-nyc/agent.py
-
curl -L -o agent.py https://huggingface.co/spaces/lablab-ai-amd-developer-hackathon/riprap-nyc/resolve/main/agent.py
1.42 kB
| """Riprap agent CLI β address β cited briefing via the Burr FSM. | |
| Usage: | |
| python agent.py "180 Beach 35 St, Queens" | |
| python agent.py "280 Broome St, Manhattan" --json | |
| """ | |
| from __future__ import annotations | |
| import argparse | |
| import json | |
| import sys | |
| import warnings | |
| warnings.filterwarnings("ignore") | |
| from app.fsm import run # noqa: E402 | |
| def main() -> int: | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("query", help="NYC address or natural-language location") | |
| ap.add_argument("--json", action="store_true", help="emit full JSON state") | |
| args = ap.parse_args() | |
| print(f"\n query: {args.query}", file=sys.stderr) | |
| print(" running FSM... (Granite 4.1 + open data, all local)\n", file=sys.stderr) | |
| result = run(args.query) | |
| if args.json: | |
| print(json.dumps(result, indent=2, default=str)) | |
| return 0 | |
| print("βββ trace " + "β" * 56) | |
| for step in result["trace"]: | |
| ok = "β" if step["ok"] else "β" | |
| line = f" {ok} {step['step']:22s} {step.get('elapsed_s', 0):>5.2f}s" | |
| if step.get("result"): | |
| line += " " + json.dumps(step["result"], default=str) | |
| elif step.get("err"): | |
| line += " ERR: " + step["err"] | |
| print(line) | |
| print("\nβββ cited report " + "β" * 49) | |
| print() | |
| print(result["paragraph"]) | |
| print() | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |