Spaces:
Running
Running
File size: 630 Bytes
c184858 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# Use Python 3.9
FROM python:3.9
# Set working directory
WORKDIR /code
# Copy files
COPY ./requirements.txt /code/requirements.txt
# Install dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the rest of the code (server.py and pkl file)
COPY . /code
# Create a writable directory for cache (Fixes permission errors on HF Spaces)
RUN mkdir -p /code/cache
ENV TRANSFORMERS_CACHE=/code/cache
ENV HF_HOME=/code/cache
RUN chmod -R 777 /code/cache
# Start the server on port 7860 (Hugging Face default)
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"] |