I have attached my Dockerfile. The image is built but the textract is not working for doc format.
FROM ubuntu:18.04
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \
mupdf-tools -y \
tesseract-ocr -y \
ocrmypdf -y \
swig -y \
build-essential -y \
libssl-dev -y \
libffi-dev -y \
python3-dev -y\
libmpc-dev \
libgmp-dev \
libmpfr-dev \
lib32ncurses5-dev -y \
gcc -y \
python3 \
python3-setuptools \
python3-pip \
antiword -y \
&& apt-get clean \
&& apt-get autoremove
ADD . /home/App
WORKDIR /home/App
COPY requirements.txt ./
COPY . .
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
VOLUME ["/data"]
EXPOSE 8080
ENV PORT 8080
CMD exec gunicorn --bind :$PORT main:app --workers 4 --threads 4 --timeout 60
This is my python implementation for textract
try:
try:
import textract
except ImportError:
return ' '
text = textract.process(doc_path).decode('utf-8')
return text
except KeyError:
return ' '
The implementation is perfectly working on google-colab but not in Docker image.