fix: use MODELS_PATH env var for AI model paths instead of hardcoded /opt/models

The on-demand feature download system stores models at /data/ai/models/
(set via MODELS_PATH env var), but all Python scripts hardcoded
/opt/models/ as the base path. Each script now reads MODELS_PATH and
falls back to /opt/models for backward compatibility.
This commit is contained in:
ashim-hq
2026-04-18 10:17:01 +08:00
parent 28462c8f60
commit d7b6037b3d
9 changed files with 36 additions and 19 deletions
+3 -1
View File
@@ -78,8 +78,10 @@ def detect_with_solutions(img_array):
# ── New API: mp.tasks (mediapipe >= 0.10.30) ───────────────────────
_MODELS_BASE = os.environ.get("MODELS_PATH", "/opt/models")
MODEL_URL = "https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task"
_DOCKER_MODEL_PATH = "/opt/models/mediapipe/face_landmarker.task"
_DOCKER_MODEL_PATH = os.path.join(_MODELS_BASE, "mediapipe", "face_landmarker.task")
MODEL_DIR = os.path.join(os.path.dirname(__file__), "..", "..", "..", ".models")
MODEL_PATH = os.path.join(MODEL_DIR, "face_landmarker.task")