Spaces:
Sleeping
Sleeping
File size: 1,192 Bytes
a20a1e3 2e6bc1d 4d5ce5c a20a1e3 4d5ce5c a20a1e3 4d5ce5c a20a1e3 f4b8edb a20a1e3 4d5ce5c a20a1e3 4d5ce5c 485e497 e3ab2bf 6463f1f 4d5ce5c a20a1e3 4d5ce5c 136fefe 4d5ce5c a20a1e3 4d5ce5c a20a1e3 4d5ce5c a20a1e3 e3ab2bf | 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 | # Hugging Face Spaces Docker Runtime
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
tesseract-ocr \
tesseract-ocr-eng \
poppler-utils \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
libgl1 \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
# Upgrade pip first
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# Install PyTorch CPU version first (before other packages that might depend on it)
RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu \
torch torchvision
# Install remaining dependencies from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY . .
# Create necessary directories
RUN mkdir -p output pdfs uploads
# Expose Hugging Face Spaces default port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:7860/ || exit 1
# Run Flask app
CMD ["python", "app.py"]
|