Auto-download U2Net model on startup; remove dead PyTorch U2Net module
U2Net only ever downloaded lazily on the first Remove Background click, unlike SAM which retries on every container start. If that one attempt failed (DNS/firewall) the model was never fetched again, surfacing as "No background removal method available. Install u2net or rembg." Mirrors the existing SAM auto-download/AUTO_DOWNLOAD_SAM pattern for U2Net, and documents manual host-side recovery in the README. Also deletes backend/app/services/u2net_model.py (hand-written U2NET/U2NETP PyTorch classes) — unused since tools.py switched to cv2.dnn.readNetFromONNX for background removal.
This commit is contained in:
@@ -166,6 +166,11 @@ DATABASE_URL=sqlite:///./data/ai_photo_edit.db
|
||||
# When false: Skips download, Smart Select uses Replicate API (requires REPLICATE_API_KEY)
|
||||
AUTO_DOWNLOAD_SAM=true
|
||||
|
||||
# Auto-download U2Net model on startup (true/false)
|
||||
# When true (default): Downloads U2Net model (~176MB) on first startup for offline Remove Background
|
||||
# When false: Skips download, Remove Background falls back to rembg (if installed)
|
||||
AUTO_DOWNLOAD_U2NET=true
|
||||
|
||||
# Allow users to select model per-edit
|
||||
ALLOW_MODEL_OVERRIDE=true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user