File size: 1,411 Bytes
4b0b144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

WORKDIR /app

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    python3 python3-pip python3-dev \
    git build-essential && \
    rm -rf /var/lib/apt/lists/*

RUN ln -sf /usr/bin/python3 /usr/bin/python

RUN pip install --no-cache-dir --upgrade pip "setuptools>=68" wheel

# Install PyTorch with CUDA 12.1
RUN pip install --no-cache-dir \
    torch==2.5.1 torchvision==0.20.1 \
    --index-url https://download.pytorch.org/whl/cu121

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

RUN git clone https://github.com/YZY-stack/Effort-AIGI-Detection.git model_code && \
    cd model_code && \
    git checkout 96f5dea2b534d400cfd7003f053c7e93c8e16461 && \
    cd ..

RUN mkdir -p /app/weights /app/hf_cache
COPY weights/ /app/weights/

COPY app.py .

ENV MODEL_PORT=5006
ENV PRELOAD_MODEL=false
ENV MODEL_TIMEOUT=600
ENV EFFORT_CHECKPOINT=genimage_effort.pth
ENV HF_HOME=/app/hf_cache
ENV TRANSFORMERS_CACHE=/app/hf_cache/hub
ENV PYTHONPATH=/app/model_code/DeepfakeBench/training:/app/model_code/DeepfakeBench/training/detectors:/app/model_code/DeepfakeBench/training/utils:$PYTHONPATH

EXPOSE ${MODEL_PORT}

RUN adduser --disabled-password --gecos '' appuser && \
    chown -R appuser:appuser /app/hf_cache
USER appuser

CMD ["python", "app.py"]