- Docker and Docker Compose installed
docker compose up --build
Service | URL | Description |
---|---|---|
Gateway | http://localhost:5000 | Unified API endpoint |
CLIP | http://localhost:5001 | Visual classifier |
SAM | http://localhost:5002 | Image segmentation |
All client requests go through: http://localhost:5000/
Classifies an image based on candidate labels.
Request
{
"image": "https://example.com/sample_image.jpg",
"classes": ["dog", "cat", "car", "tree"]
}
Response
{
"classes":["dog"],
"indices":[0],
"scores":[0.9989804625511169]
}
Returns all segmentation masks for an image.
Request
{
"image": "https://example.com/sample_image.jpg"
}
Returns masks guided by point prompts.
Request
{
"image": "https://example.com/sample_image.jpg",
"points": [[500, 375], [250, 200]],
"labels": [1, 0]
}
Returns masks guided by bounding box.
Request
{
"image": "https://example.com/sample_image.jpg",
"bbox": [100, 100, 400, 400]
}
-
Edit the Model’s Code
- Add a new route to
clip/app.py
orsam/app.py
.
- Add a new route to
-
Expose It Through the Gateway
- Update or create a service method in
gateway/services/<model>_service.py
. - Add a route in
gateway/model_router.py
to call the service.
- Update or create a service method in
-
Rebuild
docker-compose up --build
-
Create a New Model Folder
mkdir depth cp -r clip/* depth/
-
Implement Your Model in
depth/app.py
-
Create a Service File Create
gateway/services/depth_service.py
with logic to call the new API. -
Add Routes Update
gateway/model_router.py
with new/depth/...
routes. -
Update Docker Compose
services: depth: build: ./depth ports: - "5003:5003"
-
Rebuild and Start
docker-compose up --build
- Add support for the depthanything model
- Add CLI support to create APIs for client provided models