inspecTech_CV / README.md
mlbench123's picture
Update README.md
7c1f084 verified
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_left and rear_right must 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)

  1. gemini-2.0-flash β€” primary (best quality + speed, free)
  2. gemini-2.0-flash-lite β€” fallback 1 (lighter 2.0 variant, free tier)
  3. gemini-1.5-flash-latest β€” fallback 2 (1.5 gen, stable free tier)