Fix macOS SSL cert issue, add troubleshooting and upgrade docs

- Add SSL certificate auto-fix in FaceProtector (certifi)
- Add Troubleshooting section to README (SSL, first-run downloads)
- Add upgrade instructions for pipx/uv tool users
This commit is contained in:
test-user
2026-03-25 11:53:02 -07:00
parent d7614a7b45
commit 1a3d2a448e
2 changed files with 38 additions and 0 deletions
@@ -27,6 +27,8 @@ class FaceProtector:
self.haar_cascade = None
if self.use_yolo:
# Fix SSL certificate issues on macOS (fresh Python installs)
self._fix_ssl_certs()
logger.info(f"Loading YOLO model '{model_name}' for face protection...")
self.detector = YOLO(model_name)
else:
@@ -71,6 +73,20 @@ class FaceProtector:
bboxes.append((x1, y1, x2, y2))
return bboxes
@staticmethod
def _fix_ssl_certs() -> None:
"""Set SSL_CERT_FILE from certifi if not already set (macOS fix)."""
import os
if os.environ.get("SSL_CERT_FILE"):
return
try:
import certifi
os.environ["SSL_CERT_FILE"] = certifi.where()
except ImportError:
pass
def extract_faces(self, image: np.ndarray) -> list[tuple[tuple[int, int, int, int], np.ndarray]]:
"""
Extract faces from the image.