File size: 774 Bytes
619b919
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

# HuggingFace Spaces runs as non-root user 1000
RUN useradd -m -u 1000 user
WORKDIR /app

# System deps required by OpenCV and PaddleOCR
RUN apt-get update && apt-get install -y --no-install-recommends \
    libglib2.0-0 \
    libgl1 \
    libgomp1 \
    && rm -rf /var/lib/apt/lists/*

# PaddlePaddle must be installed before paddleocr
RUN pip install --no-cache-dir paddlepaddle==3.2.2
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy app source
COPY --chown=user:user main.py .
COPY --chown=user:user ocr/ ocr/
COPY --chown=user:user utils/ utils/

USER user

ENV PADDLE_PDX_DISABLE_MODEL_SOURCE_CHECK=True

# HuggingFace Spaces expects port 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]