File size: 1,256 Bytes
be9c2f9
 
 
 
 
 
 
 
 
8aa2607
74cb748
 
 
 
8aa2607
 
74cb748
8aa2607
be9c2f9
 
8aa2607
 
be9c2f9
8aa2607
be9c2f9
74cb748
be9c2f9
8aa2607
 
 
 
 
 
 
 
 
 
 
 
 
 
 
be9c2f9
74cb748
 
be9c2f9
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
FROM python:3.10

# System deps
RUN apt-get update && apt-get install -y \
    git git-lfs ffmpeg libgl1 libsm6 libxext6 build-essential \
    && rm -rf /var/lib/apt/lists/* && git lfs install

WORKDIR /workspace

# Env: force CPU, set Gradio defaults
ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
    PIP_NO_CACHE_DIR=1 \
    HF_HUB_ENABLE_HF_TRANSFER=1 \
    GRADIO_SERVER_NAME=0.0.0.0 \
    GRADIO_SERVER_PORT=7860 \
    CUDA_VISIBLE_DEVICES=""

# Faster pip
RUN python -m pip install -U pip

# 1) PyTorch CPU (no CUDA index URL)
RUN pip install torch==2.7.0 torchvision==0.22.0

# 2) App requirements (keep torch & dots.ocr OUT of requirements.txt)
COPY requirements.txt .
RUN pip install -r requirements.txt

# 3) Dots OCR runtime deps (GPU-free set) that the package expects
#    We install them explicitly so we can install dots.ocr with --no-deps
RUN pip install \
    transformers==4.51.3 \
    modelscope==1.29.0 \
    gradio_image_annotation==0.4.0 \
    openai==1.99.9 \
    qwen_vl_utils==0.0.11 \
    sentencepiece \
    "protobuf<4"

# 4) Install dots.ocr WITHOUT auto-deps (prevents flash-attn install on CPU)
RUN pip install --no-deps git+https://github.com/rednote-hilab/dots.ocr.git

# 5) App code
COPY . .

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