Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
MinerU
Commits
92b981bd
Commit
92b981bd
authored
Aug 01, 2024
by
myhloli
Browse files
Merge remote-tracking branch 'origin/master'
parents
fc18a5cf
a5e13b97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
26 deletions
+4
-26
README_zh-CN_v2.md
README_zh-CN_v2.md
+4
-3
magic_pdf/cli/magicpdf.py
magic_pdf/cli/magicpdf.py
+0
-23
No files found.
README_zh-CN_v2.md
View file @
92b981bd
...
...
@@ -34,7 +34,7 @@
# 更新记录
-
2024/07/
1
8 首次开源
-
2024/07/
0
8 首次开源
<!-- TABLE OF CONTENT -->
...
...
@@ -107,7 +107,7 @@ https://github.com/user-attachments/assets/4bea02c9-6d54-4cd6-97ed-dff14340982c
-
Linux/Windows + CUDA
**软硬件环境支持说明**
**
⚠️安装前必看——
软硬件环境支持说明**
为了确保项目的稳定性和可靠性,我们在开发过程中仅对特定的软硬件环境进行优化和测试。这样当用户在推荐的系统配置上部署和运行项目时,能够获得最佳的性能表现和最少的兼容性问题。
...
...
@@ -194,7 +194,7 @@ pip install magic-pdf[full]==0.6.2b1 detectron2 --extra-index-url https://wheels
```
bash
magic-pdf
-p
{
some_pdf
}
-o
{
some_output_dir
}
```
其中
`{some_pdf}`
可以使单个pdf文件,也可以是一个包含多个pdf文件的目录。
运行完命令后输出的结果会保存在
`{some_output_dir}`
目录下, 输出的文件列表如下
```
text
...
...
@@ -262,6 +262,7 @@ TODO
-
阅读顺序基于规则的分割,在一些情况下会乱序
-
列表、代码块、目录在layout模型里还没有支持
-
漫画书、艺术图册、小学教材、习题尚不能很好解析
-
在一些公式密集的PDF上强制启用OCR效果会更好
好消息是,这些我们正在努力实现!
...
...
magic_pdf/cli/magicpdf.py
View file @
92b981bd
"""
这里实现2个click命令:
第一个:
接收一个完整的s3路径,例如:s3://llm-pdf-text/pdf_ebook_and_paper/pre-clean-mm-markdown/v014/part-660420b490be-000008.jsonl?bytes=0,81350
1)根据~/magic-pdf.json里的ak,sk等,构造s3cliReader读取到这个jsonl的对应行,返回json对象。
2)根据Json对象里的pdf的s3路径获取到他的ak,sk,endpoint,构造出s3cliReader用来读取pdf
3)从magic-pdf.json里读取到本地保存图片、Md等的临时目录位置,构造出LocalImageWriter,用来保存截图
4)从magic-pdf.json里读取到本地保存图片、Md等的临时目录位置,构造出LocalIRdWriter,用来读写本地文件
最后把以上步骤准备好的对象传入真正的解析API
第二个:
接收1)pdf的本地路径。2)模型json文件(可选)。然后:
1)根据~/magic-pdf.json读取到本地保存图片、md等临时目录的位置,构造出LocalImageWriter,用来保存截图
2)从magic-pdf.json里读取到本地保存图片、Md等的临时目录位置,构造出LocalIRdWriter,用来读写本地文件
3)根据约定,根据pdf本地路径,推导出pdf模型的json,并读入
效果:
python magicpdf.py json-command --json s3://llm-pdf-text/scihub/xxxx.json?bytes=0,81350
python magicpdf.py pdf-command --pdf /home/llm/Downloads/xxxx.pdf --model /home/llm/Downloads/xxxx.json 或者 python magicpdf.py --pdf /home/llm/Downloads/xxxx.pdf
"""
import
os
import
json
as
json_parse
import
click
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment