Spaces:
Runtime error
Runtime error
File size: 1,214 Bytes
135b209 763116a b290e53 6370981 b34a113 45a5ef3 6370981 135b209 763116a ac7098a 763116a b290e53 763116a ac7098a b290e53 763116a b290e53 ac7098a 13965ad 763116a ac7098a 763116a 45a5ef3 b290e53 135b209 763116a b290e53 763116a b290e53 |
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 |
FROM python:3.9-slim
WORKDIR /app
# System deps (minimal and safe)
# libgl1 and libglib2.0-0 are required for OpenCV
# libgomp1 is required for PaddlePaddle math operations
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libgomp1 \
git \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip stack
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# 🔒 HARD PIN numpy BEFORE paddle
# This prevents the binary incompatibility with newer numpy 2.x
RUN pip install --no-cache-dir "numpy==1.26.4"
# PaddlePaddle CPU (stable version 2.6.2 matches well with OCR 2.7.x)
RUN pip install --no-cache-dir paddlepaddle==2.6.2
# PaddleOCR + API stack
# 2.7.3 is a "Golden" version: very stable, no weird dependency bugs
RUN pip install --no-cache-dir \
paddleocr==2.7.3 \
opencv-python-headless==4.11.0.86 \
fastapi \
uvicorn \
python-multipart \
pillow
# Copy app code
COPY main.py .
# 🚫 DO NOT preload models during build
# NOTE: The first time you send a request, it will take ~20-40s to
# download the detection and classification models.
# Subsequent requests will be fast.
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |