Add local SAM model support for offline Smart Select

- Add torch, torchvision, segment-anything to requirements
- Create download_sam_model.py script to fetch SAM checkpoint
- Update tools.py to use local SAM with Replicate API fallback
- Add SAM model check to entrypoint.sh with helpful instructions
- Model persists in /app/data/models via Docker volume mount
This commit is contained in:
Claude
2026-01-25 18:15:07 +00:00
parent 28e842e190
commit 8b96c86a94
4 changed files with 270 additions and 19 deletions
+4
View File
@@ -16,3 +16,7 @@ opencv-python-headless==4.9.0.80
scikit-image==0.22.0
rembg==2.0.50
onnxruntime==1.16.3
# SAM (Segment Anything) for smart object selection - runs locally, no API needed
torch==2.1.2
torchvision==0.16.2
segment-anything @ git+https://github.com/facebookresearch/segment-anything.git