Spaces:
Runtime error
Runtime error
| # FROM python:3.9-slim | |
| # RUN apt-get update && apt-get install -y \ | |
| # libpng-dev \ | |
| # libjpeg-dev \ | |
| # zlib1g-dev \ | |
| # tesseract-ocr \ | |
| # libtesseract-dev \ | |
| # && rm -rf /var/lib/apt/lists/* | |
| # RUN useradd -m -u 1000 user | |
| # USER user | |
| # ENV PATH="/home/user/.local/bin:$PATH" | |
| # WORKDIR /app | |
| # COPY --chown=user:user requirements.txt requirements.txt | |
| # RUN pip install --no-cache-dir --upgrade pip && \ | |
| # pip install --no-cache-dir -r requirements.txt | |
| # COPY --chown=user:user . /app | |
| # EXPOSE 7860 | |
| # # Increase timeout and reduce workers | |
| # CMD ["gunicorn", "--workers", "1", "--timeout", "600", "--bind", "0.0.0.0:7860", "app:app"] | |
| # Use an official Python runtime as the base image | |
| FROM python:3.8-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| tesseract-ocr \ | |
| libtesseract-dev \ | |
| poppler-utils \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy application code | |
| COPY . /app | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir \ | |
| flask \ | |
| flask-cors \ | |
| pdfplumber \ | |
| pillow \ | |
| pytesseract \ | |
| numpy \ | |
| torch \ | |
| transformers \ | |
| datasets \ | |
| scikit-learn \ | |
| gunicorn | |
| # Create uploads and cache directories with proper permissions | |
| RUN mkdir -p /app/uploads /app/cache && \ | |
| chmod -R 777 /app/uploads /app/cache | |
| # Set environment variable for Hugging Face cache | |
| ENV TRANSFORMERS_CACHE=/app/cache | |
| # Expose port | |
| EXPOSE 5000 | |
| # Run with Gunicorn | |
| CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"] |