changh95's picture
tt-model push bevformer-p150 (container)
ddaad99 verified
Raw History Blame Contribute Delete
1.31 kB
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
"""Build (and optionally send) a ``POST /predict`` request for bevformer-p150. Standard library only.
# the shipped sample: six cameras + the calibration preset listed by /info
S=code/tt_bevformer/samples/synthetic_6cam
python3 code/tt_bevformer/server/client.py --image CAM_FRONT=$S/CAM_FRONT.png --image CAM_FRONT_RIGHT=$S/CAM_FRONT_RIGHT.png \
--image CAM_FRONT_LEFT=$S/CAM_FRONT_LEFT.png --image CAM_BACK=$S/CAM_BACK.png \
--image CAM_BACK_LEFT=$S/CAM_BACK_LEFT.png --image CAM_BACK_RIGHT=$S/CAM_BACK_RIGHT.png \
--calib-preset synthetic_6cam --out req.json
curl -s localhost:20000/predict -H 'Content-Type: application/json' -d @req.json
# or send it directly and print the response: add --url http://127.0.0.1:20000 (no --out)
The implementation is the vendored ``ttaw/server/client.py`` (C08); this file runs it from the model repository
with any Python 3.9+, without numpy and without installing the package. In Python, use
``tt_bevformer.ttaw.server.client`` (``build_request``, ``post``, ``wait_ready``, ...).
"""
import runpy
from pathlib import Path
if __name__ == "__main__":
runpy.run_path(str(Path(__file__).resolve().parents[1] / "ttaw" / "server" / "client.py"), run_name="__main__")