Spaces:
Sleeping
Sleeping
# Use a slimmer official Python image | |
FROM python:3.9-slim | |
# Set working directory | |
WORKDIR /app | |
# Install system dependencies for PyPDF2, python-pptx, etc. | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
gcc \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy requirements file and install Python dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Set a writable cache directory for Hugging Face models | |
ENV HF_HOME=/app/hf_cache | |
RUN mkdir -p /app/hf_cache | |
# Pre-download T5-Base model and tokenizer | |
RUN python -c "from transformers import T5Tokenizer, T5ForConditionalGeneration; T5Tokenizer.from_pretrained('t5-base'); T5ForConditionalGeneration.from_pretrained('t5-base')" | |
# Copy the entire application | |
COPY . . | |
# Expose the application port | |
EXPOSE 7860 | |
# Run Gunicorn with logging | |
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "--log-level", "info", "app:app"] |