TheOneHong commited on
Commit
da826ae
·
verified ·
1 Parent(s): e0a06d3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -6
Dockerfile CHANGED
@@ -12,22 +12,41 @@ RUN apt-get update && apt-get install -y wget ca-certificates && \
12
  rm libssl1.1_1.1.1f-1ubuntu2_amd64.deb)) && \
13
  apt-get clean && rm -rf /var/lib/apt/lists/*
14
 
 
15
  RUN pip install torch==2.1.1 -i https://download.pytorch.org/whl/cpu
16
- RUN pip install paddlepaddle==2.5.1 -i https://mirror.baidu.com/pypi/simple
17
- RUN pip install transformers gradio Pillow fastapi
18
- RUN pip install paddleocr==2.7.0.3 \
 
 
 
 
 
 
 
19
  && pip uninstall -y opencv-python opencv-contrib-python \
20
  && pip install opencv-python-headless
21
 
 
 
 
 
22
  RUN useradd -m -u 1000 user
23
  USER user
24
  ENV HOME=/home/user
25
  WORKDIR $HOME/app
26
- RUN mkdir output
 
 
 
 
27
  COPY --chown=user app.py $HOME/app
28
  COPY --chown=user table.jpg $HOME/app
29
  COPY --chown=user word_1.jpg $HOME/app
30
- RUN paddleocr --image_dir ./word_1.jpg --use_angle_cls true --use_gpu false --lang ch
31
- RUN paddleocr --image_dir ./table.jpg --type=structure --table=true --lang ch
32
 
 
 
 
 
 
33
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
12
  rm libssl1.1_1.1.1f-1ubuntu2_amd64.deb)) && \
13
  apt-get clean && rm -rf /var/lib/apt/lists/*
14
 
15
+ # 安装PyTorch CPU版本
16
  RUN pip install torch==2.1.1 -i https://download.pytorch.org/whl/cpu
17
+
18
+ # 直接升级到最新的PaddlePaddle 3.0
19
+ RUN pip install paddlepaddle==3.0.0 || \
20
+ pip install paddlepaddle -i https://mirror.baidu.com/pypi/simple
21
+
22
+ # 安装基础依赖
23
+ RUN pip install transformers gradio Pillow fastapi uvicorn
24
+
25
+ # 直接升级到PaddleOCR 3.0最新版
26
+ RUN pip install paddleocr==3.0.3 \
27
  && pip uninstall -y opencv-python opencv-contrib-python \
28
  && pip install opencv-python-headless
29
 
30
+ # PaddleOCR 3.0额外依赖
31
+ RUN pip install shapely pyclipper
32
+
33
+ # 创建用户
34
  RUN useradd -m -u 1000 user
35
  USER user
36
  ENV HOME=/home/user
37
  WORKDIR $HOME/app
38
+
39
+ # 创建输出目录
40
+ RUN mkdir -p output
41
+
42
+ # 复制文件
43
  COPY --chown=user app.py $HOME/app
44
  COPY --chown=user table.jpg $HOME/app
45
  COPY --chown=user word_1.jpg $HOME/app
 
 
46
 
47
+ # 使用PaddleOCR 3.0的新CLI命令预热模型
48
+ RUN paddleocr ocr -i ./word_1.jpg --lang ch --device cpu
49
+ RUN paddleocr table_structure -i ./table.jpg --lang ch --device cpu || echo "Table structure preload completed"
50
+
51
+ # 启动命令
52
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]