nontGcob's picture
fix spacy and en_core_web_sm errors
0bc101b
raw
history blame
850 Bytes
FROM python:3.10
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Install spaCy model
RUN python -m spacy download en_core_web_sm
# Patch SpaCy to use Pydantic v1 in case v2 is installed
RUN sed -i 's/from pydantic import ConstrainedStr/from pydantic.v1 import ConstrainedStr/' \
/usr/local/lib/python3.10/site-packages/spacy/schemas.py
# Copy the local en_core_web_sm-3.0.0.tar.gz file into the container
# COPY ./en_core_web_sm-3.0.0.tar.gz /models/en_core_web_sm-3.0.0.tar.gz
# Install the spaCy model from the .tar.gz file
# RUN pip install /models/en_core_web_sm-3.0.0.tar.gz
# Clean up the .tar.gz file after installation
# RUN rm /models/en_core_web_sm-3.0.0.tar.gz
COPY . .
CMD ["waitress-serve", "--host", "0.0.0.0", "--port", "7860", "app:app"]