pcb-defect-api / serve /__init__.py
michaelandrew35's picture
Deploy c2f35a3b from GitLab CI
9a12c0e verified
Raw History Blame Contribute Delete
324 Bytes
"""FastAPI inference service for the PCB defect detector."""
import os
# Refuse to decode absurdly large images (decompression bombs) inside OpenCV itself.
# Must be set before cv2 is imported anywhere in the process.
os.environ.setdefault("OPENCV_IO_MAX_IMAGE_PIXELS", os.environ.get("MAX_IMAGE_PIXELS", str(40_000_000)))