File size: 924 Bytes
e3be212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e7d0dbe
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
FROM python:3.10-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV MODEL_PATH=RufusRubin777/GOT-OCR2_0_CPU

WORKDIR /app

RUN apt-get update && apt-get install -y \
    build-essential \
    libpq-dev \
    && rm -rf /var/lib/apt/lists/*

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

# Download NLTK data
RUN python -m nltk.downloader punkt punkt_tab

RUN mkdir -p /root/.cache/huggingface
VOLUME /root/.cache/huggingface

RUN python -c "from transformers_modules.stepfun-ai.GOT-OCR2_0.modeling_GOT import GOTModel, GOTConfig; \
    from transformers import AutoTokenizer; \
    model_path='stepfun-ai/GOT-OCR2_0'; \
    config = GOTConfig.from_pretrained(model_path); \
    model = GOTModel.from_pretrained(model_path, config=config); \
    tokenizer = AutoTokenizer.from_pretrained(model_path)"

COPY . .

EXPOSE 7860

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