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
b9667fd3
Commit
b9667fd3
authored
Aug 01, 2024
by
liukaiwen
Browse files
add table recognition and conversion to LaTeX
parent
dbe628ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
magic_pdf/dict2md/ocr_mkcontent.py
magic_pdf/dict2md/ocr_mkcontent.py
+0
-1
magic_pdf/model/pdf_extract_kit.py
magic_pdf/model/pdf_extract_kit.py
+2
-1
No files found.
magic_pdf/dict2md/ocr_mkcontent.py
View file @
b9667fd3
...
...
@@ -124,7 +124,6 @@ def ocr_mk_markdown_with_para_core_v2(paras_of_layout, mode, img_buket_path=""):
for
block
in
para_block
[
'blocks'
]:
# 1st.拼table_caption
if
block
[
'type'
]
==
BlockType
.
TableCaption
:
table_caption
=
merge_para_with_text
(
block
)
para_text
+=
table_caption
for
block
in
para_block
[
'blocks'
]:
# 2nd.拼table_body
if
block
[
'type'
]
==
BlockType
.
TableBody
:
for
line
in
block
[
'lines'
]:
...
...
magic_pdf/model/pdf_extract_kit.py
View file @
b9667fd3
...
...
@@ -104,6 +104,7 @@ class CustomPEKModel:
self
.
apply_layout
=
kwargs
.
get
(
"apply_layout"
,
self
.
configs
[
"config"
][
"layout"
])
self
.
apply_formula
=
kwargs
.
get
(
"apply_formula"
,
self
.
configs
[
"config"
][
"formula"
])
self
.
table_config
=
kwargs
.
get
(
"table_config"
,
self
.
configs
[
"config"
][
"table_config"
])
self
.
apply_table
=
self
.
table_config
.
get
(
"is_table_recog_enable"
,
False
)
self
.
apply_ocr
=
ocr
logger
.
info
(
"DocAnalysis init, this may take some times. apply_layout: {}, apply_formula: {}, apply_ocr: {}"
.
format
(
...
...
@@ -139,7 +140,7 @@ class CustomPEKModel:
self
.
ocr_model
=
ModifiedPaddleOCR
(
show_log
=
show_log
)
# init structeqtable
if
self
.
table_config
.
get
(
"is_table_recog_enable"
,
False
)
:
if
self
.
apply_table
:
max_time
=
self
.
table_config
.
get
(
"max_time"
,
400
)
self
.
table_model
=
table_model_init
(
str
(
os
.
path
.
join
(
models_dir
,
self
.
configs
[
"weights"
][
"table"
])),
max_time
=
max_time
,
_device_
=
self
.
device
)
...
...
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