| --- |
| title: Ais Api |
| emoji: 🦀 |
| colorFrom: yellow |
| colorTo: gray |
| sdk: docker |
| app_port: 7860 |
| pinned: false |
| --- |
| |
|
|
| # YOLO Weld Type Detector — FastAPI |
|
|
| A simple REST API around an Ultralytics YOLO model for weld-type detection. |
|
|
| ## Endpoints |
|
|
| - `GET /health` — quick status |
| - `POST /predict` — run detection |
|
|
| ### Auth (optional) |
|
|
| Set a secret named `API_TOKEN` in your Space (Settings â–¸ Secrets). |
| Send requests with `Authorization: Bearer <token>`. |
|
|
| ### Python POST (with Requests) |
|
|
| ``` |
| from pathlib import Path |
| import requests |
| |
| SPACE_URL = "https://csmith715-ais-api.hf.space/predict" |
| IMG_PATH = Path("path-to-weld-file.jpg") |
| |
| with IMG_PATH.open("rb") as f: |
| files = {"file": (IMG_PATH.name, f, "image/jpeg")} |
| r = requests.post(SPACE_URL, files=files, timeout=100) |
| |
| r.json() |
| |
| ``` |