FROM python:3.10.12 # Set the working directory in the container WORKDIR /app # Set the environment variable for the Hugging Face cache ENV TRANSFORMERS_CACHE=/app/.cache # Copy the current directory contents into the container at /app COPY . /app # Install the Python dependencies from requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Create the cache directory with appropriate permissions RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache # Start the FastAPI app on port 7860, the default port expected by Spaces CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]