Spaces:
Runtime error
Runtime error
# 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, including sentencepiece and accelerate | |
RUN pip install --no-cache-dir \ | |
flask \ | |
flask-cors \ | |
pdfplumber \ | |
pillow \ | |
pytesseract \ | |
numpy \ | |
torch \ | |
transformers \ | |
datasets \ | |
scikit-learn \ | |
gunicorn \ | |
sentencepiece \ | |
accelerate | |
# Create uploads, cache, and fine-tuning directories with proper permissions | |
RUN mkdir -p /app/uploads /app/cache /app/pegasus_finetune /app/bert_finetune /app/legalbert_finetune && \ | |
chmod -R 777 /app/uploads /app/cache /app/pegasus_finetune /app/bert_finetune /app/legalbert_finetune | |
# Set environment variable for Hugging Face cache | |
ENV HF_HOME=/app/cache | |
# Expose port | |
EXPOSE 5000 | |
# Run with Gunicorn | |
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"] |