File size: 1,223 Bytes
59f9119
b0564a9
59f9119
 
 
 
 
4815451
 
 
59f9119
 
16dde95
59f9119
263140f
59f9119
de927b2
0928fde
59f9119
 
 
 
 
 
 
 
 
 
 
 
50f93a8
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
29
30
31
# 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://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb \
    && dpkg -i libssl1.1_1.1.1f-1ubuntu2.24_amd64.deb \
    && rm libssl1.1_1.1.1f-1ubuntu2.24_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://mirrors.cloud.tencent.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==4.5.5.64
RUN pip install "numpy<2.0.0"

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 ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]