Spaces:
Sleeping
Sleeping
| # Use a slim Python base | |
| FROM python:3.10-slim | |
| # System deps for Pillow/torchvision image ops | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libgl1 libglib2.0-0 && \ | |
| rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy dependency files first (better cache) | |
| COPY requirements.txt /app/requirements.txt | |
| # Install general Python deps | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Install CUDA-enabled PyTorch for T4 (CUDA 12.1 wheels) | |
| # Adjust versions if you need to pin; these align well with torch/vision 2.2/0.17+. | |
| RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cu121 \ | |
| torch torchvision | |
| # Copy the rest of the app | |
| COPY . /app | |
| # Hugging Face sets $PORT; Gunicorn will bind to it. | |
| ENV PORT=7860 | |
| ENV MODEL_PATH=models/alexnext_vsf_bext.pth | |
| ENV CONFUSion_PATH=images/TP.jpg | |
| ENV TP_PATH=images/TP.jpg | |
| ENV TN_PATH=images/TN.jpg | |
| ENV FN_PATH=images/FN.jpg | |
| ENV FP_PATH=images/FP.jpg | |
| ENV FLASK_DEBUG=0 | |
| # Single worker (GPU inference), thread worker for simplicity | |
| CMD exec gunicorn -w 1 -k gthread -b 0.0.0.0:$PORT app:app | |