Spaces:
Runtime error
Runtime error
File size: 1,373 Bytes
c401070 59d56ca 19ef3f9 59d56ca c29fc90 8366b4f 59d56ca 8b46fd1 263e245 8b46fd1 59d56ca 113fc4f 676be16 113fc4f 297c86f 676be16 297c86f 676be16 297c86f 8366b4f f02acca 59d56ca f11d8c5 59d56ca f11d8c5 676be16 | 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 48 49 50 51 52 53 54 | FROM python:3.10-slim
ENV APP_ENV=production
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PADDLE_PDX_DISABLE_MODEL_SOURCE_CHECK=True
ENV PADDLEOCR_HOME=/app/.paddleocr
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN mkdir -p /app/.paddleocr && python - <<'PY'
from paddleocr import PaddleOCR
for kwargs in (
{'lang': 'en', 'device': 'cpu', 'use_textline_orientation': True, 'show_log': False},
{'lang': 'en', 'device': 'cpu', 'use_textline_orientation': True},
{'lang': 'en', 'use_angle_cls': True, 'use_gpu': False, 'show_log': False},
{'lang': 'en', 'use_angle_cls': True, 'use_gpu': False}
):
try:
PaddleOCR(**kwargs)
break
except (TypeError, ValueError):
pass
print("PaddleOCR models ready")
PY
COPY . .
RUN addgroup --system app && adduser --system --ingroup app app \
&& chown -R app:app /app
USER app
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=5s --start-period=90s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:7860/api/live', timeout=3)" || exit 1
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|