Spaces:
Runtime error
Runtime error
| # Use an official Python runtime as a parent image | |
| FROM python:3.10-slim | |
| # Set the working directory in the container | |
| WORKDIR /code | |
| # Set the Hugging Face cache directory to a writable location | |
| ENV HF_HOME=/tmp/.cache/huggingface | |
| # Copy the requirements file into the container at /code | |
| COPY ./requirements.txt /code/requirements.txt | |
| # Install any needed packages specified in requirements.txt | |
| # --no-cache-dir: Disables the cache to keep the image size smaller | |
| # --upgrade: Ensures pip is up to date | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # Copy the rest of the application's code into the container at /code | |
| COPY . /code | |
| # Expose the port the app will run on. Hugging Face Spaces uses 7860. | |
| EXPOSE 7860 | |
| # Command to run the app when the container launches. | |
| # Uvicorn is the server that runs our FastAPI app. | |
| # --host 0.0.0.0 makes the app accessible from outside the container. | |
| # --port 7860 matches the exposed port. | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |