goabonga/reachy-vision-api
Reachy Vision API
FastAPI-based YOLOv8 vision API for Reachy robots.
Reachy Vision API is a lightweight object detection service built with FastAPI and YOLOv8, designed to run on Hugging Face Spaces (Docker) or locally, and to be easily integrated with Reachy robots or any backend.
✨ Features
- 🔍 Object detection powered by YOLOv8
- ⚡ FastAPI HTTP API (simple & stateless)
- 🐳 Hugging Face Docker Space compatible
- 🧠 CPU-friendly (
yolov8nby default) - 🤖 Ready to integrate with Reachy Mini
- 📦 Dependency management with uv
📡 API Endpoints
Health check
GET /healthResponse:
{ "status": "ok" }Object detection
POST /detectRequest
multipart/form-data- Field:
file(image)
Example
curl -X POST \
-F "file=@image.jpg" \
http://localhost:7860/detectResponse
{
"num_detections": 2,
"detections": [
{
"class_id": 0,
"class_name": "person",
"confidence": 0.92,
"bbox_xyxy": [120.3, 45.1, 380.7, 620.9]
}
]
}🚀 Deployment (Hugging Face Space)
Recommended setup:
- Space type:
Docker - Hardware: CPU (default) or GPU
- Exposed port:
7860
Repository structure
reachy-vision-api/
├── app.py # FastAPI application
├── Dockerfile # Docker image definition
├── pyproject.toml # Project configuration and dependencies
├── uv.lock # Lockfile for reproducible builds
├── .gitignore # Git ignore rules
├── tests/ # Test suite
│ ├── __init__.py
│ ├── conftest.py # Pytest fixtures
│ └── test_api.py # API tests
└── README.mdOnce pushed, the Space will automatically build and expose:
https://<username>-<space-name>.hf.space🐳 Docker (local run)
docker build -t reachy-vision-api .
docker run -p 7860:7860 reachy-vision-api📦 Dependencies
Dependencies are managed using uv.
Main dependencies:
fastapiuvicornultralyticspillowpython-multipart
The lockfile (uv.lock) ensures reproducible builds.
🛠️ Development
Install dev dependencies:
uv sync --extra devTools
- ruff - Linter and formatter
- mypy - Static type checker
- pytest - Testing framework
- pytest-cov - Code coverage
Run tests
uv run pytestCoverage report is generated in htmlcov/ and displayed in terminal.
Lint and format
uv run ruff check .
uv run ruff format .Type checking
uv run mypy app.pyRelease workflow
This project uses commitizen for versioning and changelog generation.
To trigger a new release, push a commit to main with the message chore: release a new version:
git commit --allow-empty -m "chore: release a new version"
git push origin mainThis will:
- Bump the version based on conventional commits
- Generate/update the CHANGELOG
- Create a GitHub Release
- Sync to Hugging Face Space
🤖 Usage with Reachy
This API is designed to be called from:
- Reachy Mini
- A central VPS backend
- Another Hugging Face Space
Typical flow:
- Capture image from Reachy camera
- Send image to
/detect - Use detections for interaction, navigation, or reasoning
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
