File size: 1,086 Bytes
6645d6c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52af76f
 
 
 
 
6645d6c
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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