FROM python:3.12-slim # Install dependencies (tokenizers only; no torch needed) RUN pip install --no-cache-dir flask "transformers>=5" sentencepiece protobuf # Run as the non-root user HF Spaces expects RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ HF_HOME=/tmp/huggingface WORKDIR /home/user/app COPY --chown=user . /home/user/app # Expose the port for the app EXPOSE 7860 # Command to run app.py directly CMD ["python", "app.py"]