FROM python:3.9 # Set working directory WORKDIR /app # Copy requirements and install dependencies COPY requirements.txt . RUN python -m pip install --upgrade pip RUN pip install -r requirements.txt # Create a writable cache directory for Hugging Face models RUN mkdir -p /app/hf_home/ && chmod -R 777 /app/hf_home/ # Copy application files COPY app.py . # Set HF_HOME and run the application CMD ["sh", "-c", "export HF_HOME=/app/hf_home && uvicorn app:app --host 0.0.0.0 --port 7860"]