From d7d0431a36cbb7b4ae3bfe4ca5fba762280b1c81 Mon Sep 17 00:00:00 2001 From: Holden Date: Thu, 11 Jun 2026 22:56:47 +0000 Subject: [PATCH] fix: use INSIGHTFACE_HOME env var for model persistence Hardcoded root="~/.insightface" ignored the INSIGHTFACE_HOME env var, causing Buffalo_L to download into the container on every run instead of persisting to the mounted volume. Co-Authored-By: Claude Sonnet 4.6 --- if_curator/embeddings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/if_curator/embeddings.py b/if_curator/embeddings.py index bef696e..67cf223 100644 --- a/if_curator/embeddings.py +++ b/if_curator/embeddings.py @@ -92,7 +92,8 @@ def get_insightface_app(): # Suppress C-level output during model loading with open(os.devnull, "w") as devnull, contextlib.redirect_stdout(devnull), contextlib.redirect_stderr(devnull): - _insightface_app = FaceAnalysis(name="buffalo_l", root="~/.insightface", providers=providers) + insightface_home = os.environ.get("INSIGHTFACE_HOME", os.path.expanduser("~/.insightface")) + _insightface_app = FaceAnalysis(name="buffalo_l", root=insightface_home, providers=providers) _insightface_app.prepare(ctx_id=ctx_id, det_size=(640, 640)) return _insightface_app @@ -108,7 +109,7 @@ def get_insightface_app(): try: from insightface.app import FaceAnalysis - _insightface_app = FaceAnalysis(name="buffalo_l", root="~/.insightface") + _insightface_app = FaceAnalysis(name="buffalo_l", root=insightface_home) _insightface_app.prepare(ctx_id=-1, det_size=(640, 640)) return _insightface_app except Exception as ex: