FROM python:3.11-slim WORKDIR /app # HF Spaces expects port 7860 ENV PORT=7860 ENV HF_HOME=/app/.cache/huggingface ENV TRANSFORMERS_CACHE=/app/.cache/huggingface COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app.py . # Precreate cache dir with right perms (HF Spaces runs as uid 1000) RUN mkdir -p /app/.cache/huggingface && chmod -R 777 /app/.cache EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]