File size: 785 Bytes
f84e083
 
 
 
 
 
1f94144
 
 
b86a744
 
 
1f94144
f84e083
 
4849bdc
 
 
 
 
 
 
7543b65
 
 
f84e083
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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"]