"""Smoke test: load laya-browser from the Hub (or a local dir) and answer one recorded browser step. uv run python verify.py # downloads cklxx/laya-browser (model at the repo root) uv run python verify.py /path/to/dir # a local copy uv run python verify.py --fast # laya's TileLang fast path (CUDA) """ import json, os, sys HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.join(HERE, "apps")) from laya_browser import LayaBrowser src = next((a for a in sys.argv[1:] if not a.startswith("--")), "cklxx/laya-browser") lb = LayaBrowser.from_pretrained(src, fast="--fast" in sys.argv) body = json.load(open(os.path.join(HERE, "sample_request.json"))) # a request as jev-ultrafast sends it for _ in range(3): out = lb.systemone(body)["answers"] op = out["operation"]["choice"] print("operation:", op, round(out["operation"]["confidence"], 3)) tq = op.lower() + "_target" if tq in out: print("target:", out[tq]["choice"], body["questions"][tq]["criteria"][out[tq]["choice"]]) print("ok")