# Base image FROM python:3.11-slim # Set working directory WORKDIR /app # Copy requirements COPY requirements.txt . # Install dependencies RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt # Create writable cache directory for Hugging Face ENV HF_HOME="/tmp/huggingface" ENV HF_DATASETS_CACHE="/tmp/huggingface" ENV TRANSFORMERS_CACHE="/tmp/huggingface" # Copy app.py COPY . . # Expose default HF Space port EXPOSE 7860 # Use python -m uvicorn to avoid PATH issues CMD ["python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]