# Use the official Python 3.12 image FROM python:3.12 # Set the working directory WORKDIR /code # Copy the requirements file and install dependencies COPY ./requirements.txt /code/requirements.txt RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt # Create a cache directory with permissions so Hugging Face can download models ENV HF_HOME=/code/.cache/huggingface RUN mkdir -p $HF_HOME && chmod 777 $HF_HOME # Copy all your code and local models into the container COPY . /code # Hugging Face Spaces strictly require applications to run on port 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]