Downloads · 30 days
0
phongphamthe/inference-endpoint-poc
inference-endpoint-poc is a machine learning model from phongphamthe. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This directory is intended to be pushed as the root of a dedicated Hugging Face model repository and deployed as a custom Hugging Face Inference Endpoint.
Downloads · 30 days
0
Access
Public
Updated Jul 18, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py15.4 KB · 63%
From the Hugging Face model README
This directory is intended to be pushed as the root of a dedicated Hugging Face model repository and deployed as a custom Hugging Face Inference Endpoint.
It answers the production decision question for the current SAM3 batch-processing POC by combining:
EndpointHandlerPublish these contents at the root of the Hugging Face Hub repository:
.
├── .env.example
├── contracts/
│ ├── request.schema.json
│ └── result.schema.json
├── config/
│ └── inference-requirements.yaml
├── examples/
│ ├── depth.request.json
│ └── segmentation.request.json
├── DEPLOYMENT_CHECKLIST.md
├── handler.py
├── README.md
└── requirements.txt
The Hugging Face Inference Endpoint service only requires handler.py and requirements.txt at the repo root. The rest of the files are there to keep deployment, contracts, and smoke testing reproducible.
Set these in the Endpoint configuration UI rather than committing secrets:
HF_TOKEN: required for gated model access such as facebook/sam3HF_SAM_MODEL_ID: defaults to facebook/sam3HF_DEPTH_MODEL_ID: defaults to depth-anything/Depth-Anything-V2-Small-hfSee .env.example for the expected values.
The handler expects a payload like:
{
"inputs": [
{
"image_id": "image-0",
"image_base64": "..."
}
],
"task": "object_segmentation",
"parameters": {
"text_query": "pavement crack",
"confidence_threshold": 0.5
}
}
See examples/segmentation.request.json and examples/depth.request.json for ready-to-send payload templates.
The current handler supports two task paths:
object_segmentation: SAM3 segmentation with query-driven mask output, bounding-box derivation, and base64 PNG mask serializationdepth_estimation: depth model inference with resized grayscale depth PNG output and min/max depth metadataThe batch result shape intentionally matches the normalized response style already used in the existing Space app, including item-level status, retryable, and timing blocks.
For the first controlled benchmark deployment, use these settings from config/inference-requirements.yaml:
If Datadog export is part of the acceptance criteria, use a Team or Enterprise plan so the endpoint can expose OpenMetrics.
HF_TOKEN in endpoint environment variables.examples/segmentation.request.json.status, results[0].sam.predictions, and timing fields.From the workspace root, run:
python -m pytest tests/test_endpoint_handler.py
If the local environment lacks Python or the required packages, deploy directly to a Hugging Face endpoint and use the smoke test sequence above.