139 lines
3.5 KiB
Markdown
139 lines
3.5 KiB
Markdown
# Skinbase Vision Stack (CLIP + BLIP + YOLO + Qdrant) – Dockerized FastAPI
|
||
|
||
This repository provides **four standalone vision services** (CLIP / BLIP / YOLO / Qdrant)
|
||
and a **Gateway API** that can call them individually or together.
|
||
|
||
## Services & Ports
|
||
|
||
- `gateway` (exposed): `https://vision.klevze.net`
|
||
- `clip`: internal only
|
||
- `blip`: internal only
|
||
- `yolo`: internal only
|
||
- `qdrant`: vector DB (port `6333` exposed for direct access)
|
||
- `qdrant-svc`: internal Qdrant API wrapper
|
||
|
||
## Run
|
||
|
||
```bash
|
||
docker compose up -d --build
|
||
```
|
||
|
||
## Health
|
||
|
||
```bash
|
||
curl https://vision.klevze.net/health
|
||
```
|
||
|
||
## Universal analyze (ALL)
|
||
|
||
### With URL
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/analyze/all \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"url":"https://files.skinbase.org/img/aa/bb/cc/md.webp","limit":5}'
|
||
```
|
||
|
||
### With file upload (multipart)
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/analyze/all/file \
|
||
-F "file=@/path/to/image.webp" \
|
||
-F "limit=5"
|
||
```
|
||
|
||
## Individual services (via gateway)
|
||
|
||
### CLIP tags
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/analyze/clip -H "Content-Type: application/json" \
|
||
-d '{"url":"https://files.skinbase.org/img/aa/bb/cc/md.webp","limit":5}'
|
||
```
|
||
|
||
### CLIP tags (file)
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/analyze/clip/file \
|
||
-F "file=@/path/to/image.webp" \
|
||
-F "limit=5"
|
||
```
|
||
|
||
### BLIP caption
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/analyze/blip -H "Content-Type: application/json" \
|
||
-d '{"url":"https://files.skinbase.org/img/aa/bb/cc/md.webp","variants":3}'
|
||
```
|
||
|
||
### BLIP caption (file)
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/analyze/blip/file \
|
||
-F "file=@/path/to/image.webp" \
|
||
-F "variants=3" \
|
||
-F "max_length=60"
|
||
```
|
||
|
||
### YOLO detect
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/analyze/yolo -H "Content-Type: application/json" \
|
||
-d '{"url":"https://files.skinbase.org/img/aa/bb/cc/md.webp","conf":0.25}'
|
||
```
|
||
|
||
### YOLO detect (file)
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/analyze/yolo/file \
|
||
-F "file=@/path/to/image.webp" \
|
||
-F "conf=0.25"
|
||
```
|
||
|
||
## Vector DB (Qdrant) via gateway
|
||
|
||
### Store image embedding by URL
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/vectors/upsert \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"url":"https://files.skinbase.org/img/aa/bb/cc/md.webp","id":"img-001","metadata":{"category":"wallpaper"}}'
|
||
```
|
||
|
||
### Store image embedding by file upload
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/vectors/upsert/file \
|
||
-F "file=@/path/to/image.webp" \
|
||
-F 'id=img-002' \
|
||
-F 'metadata_json={"category":"photo"}'
|
||
```
|
||
|
||
### Search similar images by URL
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/vectors/search \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"url":"https://files.skinbase.org/img/aa/bb/cc/md.webp","limit":5}'
|
||
```
|
||
|
||
### Search similar images by file upload
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/vectors/search/file \
|
||
-F "file=@/path/to/image.webp" \
|
||
-F "limit=5"
|
||
```
|
||
|
||
### List collections
|
||
```bash
|
||
curl https://vision.klevze.net/vectors/collections
|
||
```
|
||
|
||
### Get collection info
|
||
```bash
|
||
curl https://vision.klevze.net/vectors/collections/images
|
||
```
|
||
|
||
### Delete points
|
||
```bash
|
||
curl -X POST https://vision.klevze.net/vectors/delete \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"ids":["img-001","img-002"]}'
|
||
```
|
||
|
||
## Notes
|
||
|
||
- This is a **starter scaffold**. Models are loaded at service startup.
|
||
- Qdrant data is persisted via a Docker volume (`qdrant_data`).
|
||
- For production: add auth, rate limits, and restrict gateway exposure (private network).
|
||
- GPU: you can add NVIDIA runtime later (compose profiles) if needed.
|