Spaces:
Sleeping
Sleeping
FROM python:3.9 | |
WORKDIR /code | |
COPY ./requirements.txt /code/requirements.txt | |
# Set the cache directory for transformers and Hugging Face Hub within the container | |
ENV HF_HOME=/code/cache/huggingface/hub | |
# Create the cache directories and set permissions | |
RUN mkdir -p $HF_HOME && \ | |
chown -R 1000:1000 $HF_HOME | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
# Set an environment variable for the NLTK data directory | |
ENV NLTK_DATA /code/nltk_data | |
# Create the directory for NLTK data and download the 'punkt' tokenizer models | |
RUN mkdir -p $NLTK_DATA && \ | |
python -m nltk.downloader -d $NLTK_DATA punkt | |
# Download the spaCy model | |
RUN python -m spacy download en_core_web_sm | |
COPY . . | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |