Spaces:
Runtime error
Runtime error
File size: 1,017 Bytes
e4b7f54 9adb515 e4b7f54 2f465bd 9adb515 2f465bd e4b7f54 2f465bd 210935f 2f465bd 210935f e4b7f54 |
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 |
FROM python:3.10-slim
# System dependencies
RUN apt-get update && apt-get install -y \
poppler-utils \
tesseract-ocr \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# EasyOCR model dir (must be writable)
ENV EASY_OCR_DIR=/app/.EasyOCR
RUN mkdir -p $EASY_OCR_DIR/user_network
# Copy requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# ⚡ Pre-download EasyOCR detection + recognition models
RUN python3 - <<'EOF'
import easyocr, os
MODEL_DIR = "/app/.EasyOCR"
USER_NET_DIR = os.path.join(MODEL_DIR, "user_network")
os.makedirs(MODEL_DIR, exist_ok=True)
os.makedirs(USER_NET_DIR, exist_ok=True)
# preload both en + hi recognition + detection
reader = easyocr.Reader(['en', 'hi'],
model_storage_directory=MODEL_DIR,
user_network_directory=USER_NET_DIR,
download_enabled=True
)
EOF
# Copy app
COPY app.py .
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|