lhk229
|
d24c6ed608
|
Add FastAPI HTTP service for background removal
Wrap the BGfilter matting pipeline in a long-running FastAPI service
(POST /remove-background, GET /healthz) exposing only screen_color and
seg_model, matching the birefnet-service request contract.
- bgfilter/pipeline.py: add in-memory run_rgb entry returning a
MattingResult; allow injecting a shared runner/segmenter. CLI file
path (run_image) behaviour is unchanged.
- bgfilter/service.py: PipelineManager caches one shared ViTMatte runner
and per-backend segmenters, so screen_color/seg_model never reload a
model.
- app.py: thin FastAPI layer -- param validation, image decode/encode,
error codes (400/413/500), timing headers, global asyncio lock.
- requirements.txt: fastapi, uvicorn[standard], python-multipart.
- README + design doc: HTTP service usage and HF-mirror/proxy/Xet
download notes.
Verified end-to-end (base ViTMatte + BiRefNet + anime-seg): 11/11
acceptance checks pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
2026-07-02 12:08:25 +00:00 |
|