GoMini / examples /choose.py
Mhmadhassnz's picture
Release GoMini v4: native checkpoint, Q8_0 and scoped development results
37b50ad verified
Raw History Blame Contribute Delete
780 Bytes
"""One-request interface example; no browser action or training is performed."""
import argparse
import json
import subprocess
import sys
from pathlib import Path
root = Path(__file__).resolve().parents[1]
parser = argparse.ArgumentParser()
parser.add_argument("--q8", action="store_true")
parser.add_argument("--url", default="http://127.0.0.1:8765")
args = parser.parse_args()
row = json.loads((root / "example_request.json").read_text(encoding="utf-8"))
command = [sys.executable, str(root / "adapter" / ("q8_client.py" if args.q8 else "choose_native.py"))]
if args.q8:
command += ["--url", args.url]
result = subprocess.run(command, input=json.dumps(row) + "\n", text=True, capture_output=True, check=True)
sys.stderr.write(result.stderr)
sys.stdout.write(result.stdout)