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
34bde6d8
Commit
34bde6d8
authored
Apr 08, 2024
by
赵小蒙
Browse files
classify后在jso根层级添加_pdf_type标识,同时取消对非文本类pdf的drop
parent
f65be6e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
magic_pdf/pipeline.py
magic_pdf/pipeline.py
+4
-2
No files found.
magic_pdf/pipeline.py
View file @
34bde6d8
...
@@ -130,6 +130,7 @@ def classify_by_type(jso: dict, debug_mode=False) -> dict:
...
@@ -130,6 +130,7 @@ def classify_by_type(jso: dict, debug_mode=False) -> dict:
classify_time
=
int
(
time
.
time
()
-
start_time
)
# 计算执行时间
classify_time
=
int
(
time
.
time
()
-
start_time
)
# 计算执行时间
if
is_text_pdf
:
if
is_text_pdf
:
pdf_meta
[
"is_text_pdf"
]
=
is_text_pdf
pdf_meta
[
"is_text_pdf"
]
=
is_text_pdf
jso
[
"_pdf_type"
]
=
"TXT"
jso
[
"pdf_meta"
]
=
pdf_meta
jso
[
"pdf_meta"
]
=
pdf_meta
jso
[
"classify_time"
]
=
classify_time
jso
[
"classify_time"
]
=
classify_time
# print(json.dumps(pdf_meta, ensure_ascii=False))
# print(json.dumps(pdf_meta, ensure_ascii=False))
...
@@ -144,10 +145,11 @@ def classify_by_type(jso: dict, debug_mode=False) -> dict:
...
@@ -144,10 +145,11 @@ def classify_by_type(jso: dict, debug_mode=False) -> dict:
else
:
else
:
# 先不drop
# 先不drop
pdf_meta
[
"is_text_pdf"
]
=
is_text_pdf
pdf_meta
[
"is_text_pdf"
]
=
is_text_pdf
jso
[
"_pdf_type"
]
=
"OCR"
jso
[
"pdf_meta"
]
=
pdf_meta
jso
[
"pdf_meta"
]
=
pdf_meta
jso
[
"classify_time"
]
=
classify_time
jso
[
"classify_time"
]
=
classify_time
jso
[
"need_drop"
]
=
True
#
jso["need_drop"] = True
jso
[
"drop_reason"
]
=
DropReason
.
NOT_IS_TEXT_PDF
#
jso["drop_reason"] = DropReason.NOT_IS_TEXT_PDF
extra_info
=
{
"classify_rules"
:
[]}
extra_info
=
{
"classify_rules"
:
[]}
for
condition
,
result
in
results
.
items
():
for
condition
,
result
in
results
.
items
():
if
not
result
:
if
not
result
:
...
...
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