"""Parse commands and show what the sample executor would run. Nothing is executed. python quickstart.py "volume 40 kar do" "connect to wifi Redmi Note 12 password hello@123" python quickstart.py # interactive """ import json, os, platform, sys # small matrices: a few BLAS threads are much faster than one per core (see eval/BENCHMARK.md). Must be set before numpy loads. _threads = "2" if platform.machine().lower() in ("aarch64", "arm64") else "4" os.environ.setdefault("OPENBLAS_NUM_THREADS", _threads); os.environ.setdefault("OMP_NUM_THREADS", _threads) HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(HERE, "model")); sys.path.insert(0, os.path.join(HERE, "executor")) from runtime import CommandModel # noqa: E402 import executor as EX # noqa: E402 model = CommandModel(os.path.join(HERE, "model")) def show(text): out = model.predict(text); meta = out.pop("_meta") plan = EX.plan(out, None, text) # None = this machine's platform; text lets it ask about bare GPIO pins print(json.dumps({"text": text, "command": out, "confidence": meta["confidence"], "latency_ms": meta["latency_ms"], "risk": plan.risk, "plan": plan.action, "would_run": plan.command or plan.note}, ensure_ascii=False, indent=1)) if len(sys.argv) > 1: for t in sys.argv[1:]: show(t) else: print("type a command (empty line to quit)") while True: t = input("> ").strip() if not t: break show(t)