Spaces:
Running
Running
| 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"] | |