Spaces:
Runtime error
Runtime error
# Use a lightweight Python runtime | |
FROM python:3.11-slim | |
# Set the working directory in the container | |
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 writable cache directory for Hugging Face models | |
RUN mkdir -p /code/hf_cache && chmod -R 777 /code/hf_cache | |
# Set environment variables for Hugging Face cache | |
ENV HF_HOME=/code/hf_cache | |
# Copy the application code | |
COPY ./main.py /code/main.py | |
# Expose the application port | |
EXPOSE 7860 | |
# Start the FastAPI application | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "300"] | |