feat: 更新 Docker 配置和服务说明,优化环境变量和服务命名

- 修改 docker-compose.yml,更新 PADDLEX_URI 环境变量,调整为 http://paddlex-ocr:8080。
- 更新 api.Dockerfile,优化代理环境变量的设置逻辑。
- 修改 paddlex.Dockerfile,更新工作目录和服务启动命令,确保使用新的配置文件。
- 新增 PP-StructureV3.yaml 配置文件,定义新的服务管道。
- 在 README.md 中添加服务说明,列出各服务及其端口信息,提升文档可读性。
This commit is contained in:
Wenjie Zhang 2025-06-25 14:16:34 +08:00
parent 4afbb42f96
commit bb4ce9e5c2
6 changed files with 264 additions and 13 deletions

View File

@ -141,7 +141,22 @@ ark:
- deepseek-r1-250120
```
本地模型部署参考 [how-to.md](./docs/how-to.md)
### 服务说明
项目中会启动多个服务,包括但不限于下面
|端口|服务|说明|
|--|--|--|
|5173|web|前端服务|
|5050|api|后端服务|
|7474, 7687|neo4j|图数据库接口|
|9000, 9001|minio|文件数据库|
|19530, 9091|mivlus|向量数据库|
|30000|mineru|PDF解析默认不启用|
|8080|paddlex|PP-Structure-V3 服务(默认不启用)|
|8081|vllm|模型本地推理服务(默认不启用)|
### 2. 向量模型和重排序模型

View File

@ -4,8 +4,8 @@ services:
context: .
dockerfile: docker/api.Dockerfile
args:
http_proxy: ${HTTP_PROXY:-""}
https_proxy: ${HTTPS_PROXY:-""}
http_proxy: ${HTTP_PROXY:-}
https_proxy: ${HTTPS_PROXY:-}
image: yuxi-api:0.1.0
container_name: api-dev
working_dir: /app
@ -33,7 +33,7 @@ services:
- NEO4J_PASSWORD=${NEO4J_PASSWORD:-0123456789}
- MILVUS_URI=${MILVUS_URI:-http://milvus:19530}
- MINERU_OCR_URI=${MINERU_OCR_URI:-http://mineru:30000}
- PADDLEX_URI=${PADDLEX_URI:-http://paddlex:8080}
- PADDLEX_URI=${PADDLEX_URI:-http://paddlex-ocr:8080}
- MINIO_URI=${MINIO_URI:-http://milvus-minio:9000}
- MODEL_DIR=/models
- RUNNING_IN_DOCKER=true
@ -202,7 +202,7 @@ services:
context: .
dockerfile: docker/paddlex.Dockerfile
image: paddlex:latest
container_name: paddlex
container_name: paddlex-ocr
profiles:
- all
volumes:

230
docker/PP-StructureV3.yaml Normal file
View File

@ -0,0 +1,230 @@
pipeline_name: PP-StructureV3
batch_size: 8
use_doc_preprocessor: True
use_seal_recognition: True
use_table_recognition: True
use_formula_recognition: True
use_chart_recognition: True
use_region_detection: True
SubModules:
LayoutDetection:
module_name: layout_detection
model_name: PP-DocLayout_plus-L
model_dir: null
batch_size: 8
threshold:
0: 0.3 # paragraph_title
1: 0.5 # image
2: 0.4 # text
3: 0.5 # number
4: 0.5 # abstract
5: 0.5 # content
6: 0.5 # figure_table_chart_title
7: 0.3 # formula
8: 0.5 # table
9: 0.5 # reference
10: 0.5 # doc_title
11: 0.5 # footnote
12: 0.5 # header
13: 0.5 # algorithm
14: 0.5 # footer
15: 0.45 # seal
16: 0.5 # chart
17: 0.5 # formula_number
18: 0.5 # aside_text
19: 0.5 # reference_content
layout_nms: True
layout_unclip_ratio: [1.0, 1.0]
layout_merge_bboxes_mode:
0: "large" # paragraph_title
1: "large" # image
2: "union" # text
3: "union" # number
4: "union" # abstract
5: "union" # content
6: "union" # figure_table_chart_title
7: "large" # formula
8: "union" # table
9: "union" # reference
10: "union" # doc_title
11: "union" # footnote
12: "union" # header
13: "union" # algorithm
14: "union" # footer
15: "union" # seal
16: "large" # chart
17: "union" # formula_number
18: "union" # aside_text
19: "union" # reference_content
ChartRecognition:
module_name: chart_recognition
model_name: PP-Chart2Table
model_dir: null
batch_size: 1
RegionDetection:
module_name: layout_detection
model_name: PP-DocBlockLayout
model_dir: null
layout_nms: True
layout_merge_bboxes_mode: "small"
SubPipelines:
DocPreprocessor:
pipeline_name: doc_preprocessor
batch_size: 8
use_doc_orientation_classify: True
use_doc_unwarping: True
SubModules:
DocOrientationClassify:
module_name: doc_text_orientation
model_name: PP-LCNet_x1_0_doc_ori
model_dir: null
batch_size: 8
DocUnwarping:
module_name: image_unwarping
model_name: UVDoc
model_dir: null
GeneralOCR:
pipeline_name: OCR
batch_size: 8
text_type: general
use_doc_preprocessor: False
use_textline_orientation: True
SubModules:
TextDetection:
module_name: text_detection
model_name: PP-OCRv5_server_det
model_dir: null
limit_side_len: 736
limit_type: min
max_side_limit: 4000
thresh: 0.3
box_thresh: 0.6
unclip_ratio: 1.5
TextLineOrientation:
module_name: textline_orientation
model_name: PP-LCNet_x1_0_textline_ori
model_dir: null
batch_size: 8
TextRecognition:
module_name: text_recognition
model_name: PP-OCRv5_server_rec
model_dir: null
batch_size: 8
score_thresh: 0.0
TableRecognition:
pipeline_name: table_recognition_v2
use_layout_detection: False
use_doc_preprocessor: False
use_ocr_model: False
SubModules:
TableClassification:
module_name: table_classification
model_name: PP-LCNet_x1_0_table_cls
model_dir: null
WiredTableStructureRecognition:
module_name: table_structure_recognition
model_name: SLANeXt_wired
model_dir: null
WirelessTableStructureRecognition:
module_name: table_structure_recognition
model_name: SLANet_plus
model_dir: null
WiredTableCellsDetection:
module_name: table_cells_detection
model_name: RT-DETR-L_wired_table_cell_det
model_dir: null
WirelessTableCellsDetection:
module_name: table_cells_detection
model_name: RT-DETR-L_wireless_table_cell_det
model_dir: null
TableOrientationClassify:
module_name: doc_text_orientation
model_name: PP-LCNet_x1_0_doc_ori
model_dir: null
SubPipelines:
GeneralOCR:
pipeline_name: OCR
text_type: general
use_doc_preprocessor: False
use_textline_orientation: True
SubModules:
TextDetection:
module_name: text_detection
model_name: PP-OCRv5_server_det
model_dir: null
limit_side_len: 736
limit_type: min
max_side_limit: 4000
thresh: 0.3
box_thresh: 0.4
unclip_ratio: 1.5
TextLineOrientation:
module_name: textline_orientation
model_name: PP-LCNet_x1_0_textline_ori
model_dir: null
batch_size: 8
TextRecognition:
module_name: text_recognition
model_name: PP-OCRv5_server_rec
model_dir: null
batch_size: 8
score_thresh: 0.0
SealRecognition:
pipeline_name: seal_recognition
batch_size: 8
use_layout_detection: False
use_doc_preprocessor: False
SubPipelines:
SealOCR:
pipeline_name: OCR
batch_size: 8
text_type: seal
use_doc_preprocessor: False
use_textline_orientation: False
SubModules:
TextDetection:
module_name: seal_text_detection
model_name: PP-OCRv4_server_seal_det
model_dir: null
limit_side_len: 736
limit_type: min
max_side_limit: 4000
thresh: 0.2
box_thresh: 0.6
unclip_ratio: 0.5
TextRecognition:
module_name: text_recognition
model_name: PP-OCRv5_server_rec
model_dir: null
batch_size: 8
score_thresh: 0
FormulaRecognition:
pipeline_name: formula_recognition
batch_size: 8
use_layout_detection: False
use_doc_preprocessor: False
SubModules:
FormulaRecognition:
module_name: formula_recognition
model_name: PP-FormulaNet_plus-L
model_dir: null
batch_size: 8
Serving:
extra:
max_num_input_imgs: null

View File

@ -8,11 +8,13 @@ WORKDIR /app
# 环境变量设置
ARG http_proxy
ARG https_proxy
ENV http_proxy=$http_proxy \
https_proxy=$https_proxy \
TZ=Asia/Shanghai \
ENV TZ=Asia/Shanghai \
UV_LINK_MODE=copy
# 只有当代理变量不为空时才设置代理
RUN if [ -n "$http_proxy" ]; then echo "export http_proxy=$http_proxy" >> /etc/environment; fi
RUN if [ -n "$https_proxy" ]; then echo "export https_proxy=$https_proxy" >> /etc/environment; fi
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 安装系统依赖
@ -34,9 +36,6 @@ RUN --mount=type=cache,target=/root/.cache/uv \
COPY ../src /app/src
COPY ../server /app/server
# 关闭代理设置
RUN unset http_proxy https_proxy
# 同步项目
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync

View File

@ -1,12 +1,15 @@
FROM ccr-2vdh3abv-pub.cnc.bj.baidubce.com/paddlex/paddlex:paddlex3.0.1-paddlepaddle3.0.0-gpu-cuda11.8-cudnn8.9-trt8.6
WORKDIR /paddle
WORKDIR /root/PaddleX/paddlex
# 安装 hpi-cpu如您所指示
RUN paddlex --install hpi-cpu
RUN paddlex --install serving
COPY docker/PP-StructureV3.yaml /root/PaddleX/paddlex/PP-StructureV3.yaml
# 暴露 PaddleX 服务端口
EXPOSE 8080
# 运行 PaddleX PP-StructureV3 流水线服务
CMD ["paddlex", "--serve", "--pipeline", "PP-StructureV3", "--host", "0.0.0.0", "--port", "8080"]
CMD ["paddlex", "--serve", "--pipeline", "PP-StructureV3.yaml", "--host", "0.0.0.0", "--port", "8080"]

View File

@ -55,3 +55,7 @@ lint.ignore = ["F401"] # 忽略的规则
dev = [
"vllm>=0.8.5.post1",
]
# uv 配置 - 使用阿里云镜像源
[tool.uv]
index-url = "https://mirrors.aliyun.com/pypi/simple/"