changh95's picture
tt-model push sceneseg-p150 (container)
aec3f16 verified
Raw History Blame Contribute Delete
1.19 kB
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
"""Build (and optionally send) a ``POST /predict`` request for sceneseg-p150. Standard library only.
# one camera image (PNG / JPEG / .npy uint8, any size; the camera name is free)
python3 code/tt_sceneseg/server/client.py --image CAM_FRONT=code/tt_sceneseg/samples/highway_normal_1.png \
--out req.json
curl -s localhost:20000/predict -H 'Content-Type: application/json' -d @req.json
# send it directly, with request params, and print the response
python3 code/tt_sceneseg/server/client.py --image CAM_FRONT=code/tt_sceneseg/samples/highway_normal_1.png \
--param score_threshold=0.5 --url http://127.0.0.1:20000
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_sceneseg.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__")