paddle-ocr-api / Dockerfile
yolo12138's picture
docker 环境部署
59f9119
raw
history blame
1.14 kB
# https://huggingface.co/spaces/gaunernst/layoutlm-docvqa-paddleocr/blob/main/Dockerfile
FROM python:3.10
ENV CUDA_VISIBLE_DEVICES=-1
ARG PIP_NO_CACHE_DIR=1
# libssl1.1 for PaddlePaddle
RUN wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb \
&& dpkg -i libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb \
&& rm libssl1.1_1.1.1f-1ubuntu2.20_amd64.deb
RUN pip install torch==2.1.1 -i https://download.pytorch.org/whl/cpu
RUN pip install paddlepaddle==2.5.1 -i https://mirror.baidu.com/pypi/simple
RUN pip install transformers gradio Pillow fastapi
RUN pip install paddleocr==2.7.0.3 \
&& pip uninstall -y opencv-python opencv-contrib-python \
&& pip install opencv-python-headless
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user
WORKDIR $HOME/app
RUN mkdir output
COPY --chown=user app.py $HOME/app
COPY --chown=user table.jpg $HOME/app
COPY --chown=user word_1.jpg $HOME/app
RUN paddleocr --image_dir ./word_1.jpg --use_angle_cls true --use_gpu false --lang ch
RUN paddleocr --image_dir ./table.jpg --type=structure --table=true --lang ch
CMD ["python", "-u", "app.py"]