Spaces:
Sleeping
Sleeping
# Use an official Python runtime as a parent image | |
FROM python:3.10-slim | |
RUN mkdir -p /cache && chmod 777 /cache | |
ENV HF_HOME="/cache" | |
ENV HUGGINGFACE_HUB_CACHE="/cache" | |
ENV TRANSFORMERS_CACHE="/cache" | |
ENV TRANSFORMERS_CACHE="/cache" | |
ENV LIBROSA_CACHE_DISABLE="1" | |
# Set the working directory in the container | |
WORKDIR /code | |
# Copy the requirements file into the container | |
COPY ./requirements.txt /code/requirements.txt | |
# Install any needed packages specified in requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
# Copy the app code into the container | |
COPY ./app.py /code/app.py | |
# Expose the port the app runs on. HF Spaces uses 7860. | |
EXPOSE 7860 | |
# Command to run the app using uvicorn | |
# The host must be 0.0.0.0 to be accessible from outside the container | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |