Spaces:
Sleeping
Sleeping
| # Crack Detection & Measurement — container image for Hugging Face Spaces. | |
| FROM python:3.12-slim | |
| # Runtime library opencv-python-headless needs. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Install the CPU-only PyTorch build first — far smaller than the default | |
| # CUDA wheel, and Hugging Face's free hardware is CPU anyway. Pinning the | |
| # same versions means the torch lines in requirements.txt are then no-ops. | |
| RUN pip install --no-cache-dir \ | |
| torch==2.12.0 torchvision==0.27.0 \ | |
| --index-url https://download.pytorch.org/whl/cpu | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| # Hugging Face Spaces routes external traffic to this port. | |
| EXPOSE 7860 | |
| CMD ["gunicorn", "--workers", "1", "--threads", "4", "--worker-class", "gthread", \ | |
| "--timeout", "180", "--bind", "0.0.0.0:7860", "app:app"] | |