Spaces:
Running
Running
| # 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"] |