Spaces:
Sleeping
Sleeping
metadata
title: Amazon Trailer Inspector
emoji: π
colorFrom: blue
colorTo: indigo
sdk: docker
app_file: app.py
pinned: false
license: mit
π Amazon Trailer Inspector β REST API
AI-powered trailer inspection pipeline exposed as a REST API.
Submit up to 6 labeled images and receive a structured JSON inspection report.
Endpoint
POST /inspect
Submit all images in one request. All aspects are analyzed in parallel.
Request Body (JSON)
{
"images": [
{ "label": "front_left", "image_base64": "<base64-string>" },
{ "label": "front_right", "image_base64": "<base64-string>" },
{ "label": "rear_left", "image_base64": "<base64-string>" },
{ "label": "rear_right", "image_base64": "<base64-string>" },
{ "label": "inside", "image_base64": "<base64-string>" },
{ "label": "door", "image_base64": "<base64-string>" }
]
}
Accepted labels: front_left, front_right, rear_left, rear_right, inside, door
- Images can be raw base64 OR a data-URI (
data:image/jpeg;base64,...) - All 6 images are optional β only send the ones you have
- Each label can appear at most once per request
rear_leftandrear_rightmust both be present for full rear confirmation
Response Body (JSON)
{
"status": "success",
"images_received": ["front_left", "front_right", "rear_left", "rear_right", "inside", "door"],
"labels_missing": [],
"report": {
"front": {
"label": "Front Left / Right",
"images_provided": ["front_left", "front_right"],
"components": {
"Sensors": "detected",
"GPS Device": "missing",
"Prime Logo": "detected",
"Trailer ID Label": "detected"
},
"notes": []
},
"rear": {
"label": "Rear Left / Right",
"images_provided": ["rear_left", "rear_right"],
"components": {
"Side Skirts / Fins": { "status": "detected", "count": "2/2" },
"Edge Kit": { "status": "partially detected (left side only)", "count": "1/2" }
},
"notes": []
},
"inside": {
"label": "Inside Trailer",
"images_provided": ["inside"],
"components": {
"Side Guards": "detected",
"Flooring": "detected"
},
"notes": []
},
"door": {
"label": "Door Details",
"images_provided": ["door"],
"components": {
"Latch Kit & Lash Links": "detected",
"Grote LED Lights": "missing"
},
"notes": []
}
}
}
Component Values
| Aspect | Component Values |
|---|---|
| Front | "detected" or "missing" (OR logic β detected if found in either left or right image) |
| Rear | "detected", "partially detected (left side only)", "partially detected (right side only)", or "missing" β plus count ("2/2", "1/2", "0/2") |
| Inside | "detected" or "missing" |
| Door | "detected" or "missing" |
Notes Field
The notes array in each aspect section contains warnings such as:
"front_left: image missing from input"β label was not submitted"rear_right: invalid image (wrong angle/side)"β model rejected the image"door: invalid image (not a valid rear door view)"β wrong image type
Other Endpoints
| Method | Path | Description |
|---|---|---|
| GET | / |
Service info |
| GET | /health |
HF_TOKEN status + models |
| GET | /docs |
Interactive Swagger UI |
Setup
Space Settings β Repository Secrets β add GEMINI_API_KEY
Get a free Gemini API key at aistudio.google.com/apikey
No credit card required β free tier includes 1,500 requests/day.
Models (Google Gemini, free tier)
gemini-2.0-flashβ primary (best quality + speed, free)gemini-2.0-flash-liteβ fallback 1 (lighter 2.0 variant, free tier)gemini-1.5-flash-latestβ fallback 2 (1.5 gen, stable free tier)