FROM python:3.10-slim WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Pre-download the model to save time during startup RUN python -c "from transformers import AutoTokenizer, AutoModel; AutoTokenizer.from_pretrained('l3cube-pune/hing-roberta'); AutoModel.from_pretrained('l3cube-pune/hing-roberta')" COPY . . # Create a non-root user and switch to it, a requirement for Hugging Face Spaces RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]