README.md 1.31 KB
Newer Older
zhougaofeng's avatar
zhougaofeng committed
1
2
# magic_pdf

zhougaofeng's avatar
zhougaofeng committed
3
4
## 安装

zhougaofeng's avatar
zhougaofeng committed
5
### 以下演示在223节点安装pdf解析模块(可以直接使用镜像:1177ea7959ce)
zhougaofeng's avatar
zhougaofeng committed
6

zhougaofeng's avatar
zhougaofeng committed
7
下载本项目
zhougaofeng's avatar
zhougaofeng committed
8

zhougaofeng's avatar
zhougaofeng committed
9
### 1、安装需要的依赖库
zhougaofeng's avatar
zhougaofeng committed
10

zhougaofeng's avatar
zhougaofeng committed
11
12
#### pip install -e .

zhougaofeng's avatar
zhougaofeng committed
13
14
### 2、安装需要的模型
`git clone https://www.modelscope.cn/opendatalab/PDF-Extract-Kit.git`
zhougaofeng's avatar
zhougaofeng committed
15
16
17
18
19
20
#### 修改magic-pdf.template.json
cd MinerU
<div align=center>
    <img src="doc/image (9).png"/>
</div>
需要注意,"models-dir":"/home/practice/model/PDF-Extract-Kit/models" 路径指向PDF-Extract-Kit/models
zhougaofeng's avatar
zhougaofeng committed
21

zhougaofeng's avatar
zhougaofeng committed
22
23
24
25
将magic-pdf.template.json 拷贝到/root目录下并改名为magic-pdf.json
<div align=center>
    <img src="doc/image (10).png"/>
</div>
zhougaofeng's avatar
zhougaofeng committed
26

zhougaofeng's avatar
zhougaofeng committed
27
### 4、启动qwen-ocr模块:
zhougaofeng's avatar
zhougaofeng committed
28

zhougaofeng's avatar
zhougaofeng committed
29
`python magic_pdf/dict2md/ocr_server.py`
zhougaofeng's avatar
zhougaofeng committed
30

zhougaofeng's avatar
zhougaofeng committed
31
默认使用6020端口,0号DCU卡 ,可以通过--dcu_id 指定卡,--server_port指定端口号
zhougaofeng's avatar
zhougaofeng committed
32

zhougaofeng's avatar
zhougaofeng committed
33
34
35
36
37
38
qwen-ocr模块启动成功:
<div align=center>
    <img src="doc/image (5).png"/>
</div>

### 5、启动pdf-server解析服务:
zhougaofeng's avatar
zhougaofeng committed
39
`python magic_pdf/tools/pdf_server.py`
zhougaofeng's avatar
zhougaofeng committed
40
41
42
43
44
45
46
<div align=center>
    <img src="doc/image (6).png"/>
</div>
启动成功:
<div align=center>
    <img src="doc/image (7).png"/>
</div>
zhougaofeng's avatar
zhougaofeng committed
47

zhougaofeng's avatar
zhougaofeng committed
48
### 6、解析pdf
zhougaofeng's avatar
zhougaofeng committed
49
`python magic_pdf/parse/common_parse.py -p [文件/目录 路径] -o [输出地址]`
zhougaofeng's avatar
zhougaofeng committed
50
51
52
53
<div align=center>
    <img src="doc/image (8).png"/>
</div>
-p指定pdf路径,-o指定输出路径