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
30be5017
Unverified
Commit
30be5017
authored
Nov 22, 2024
by
Xiaomeng Zhao
Committed by
GitHub
Nov 22, 2024
Browse files
Merge pull request #1065 from opendatalab/dev
fix(pdf_parse): improve OCR result handling
parents
809bf479
b936cb0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
magic_pdf/pdf_parse_union_core_v2.py
magic_pdf/pdf_parse_union_core_v2.py
+1
-1
No files found.
magic_pdf/pdf_parse_union_core_v2.py
View file @
30be5017
...
@@ -222,7 +222,7 @@ def txt_spans_extract_v2(pdf_page, spans, all_bboxes, all_discarded_blocks, lang
...
@@ -222,7 +222,7 @@ def txt_spans_extract_v2(pdf_page, spans, all_bboxes, all_discarded_blocks, lang
ocr_res
=
ocr_model
.
ocr
(
span_img
,
det
=
False
)
ocr_res
=
ocr_model
.
ocr
(
span_img
,
det
=
False
)
# logger.info(f"ocr_res: {ocr_res}")
# logger.info(f"ocr_res: {ocr_res}")
# logger.info(f"empty_span: {span}")
# logger.info(f"empty_span: {span}")
if
len
(
ocr_res
)
>
0
:
if
ocr_res
and
len
(
ocr_res
)
>
0
:
if
len
(
ocr_res
[
0
])
>
0
:
if
len
(
ocr_res
[
0
])
>
0
:
ocr_text
,
ocr_score
=
ocr_res
[
0
][
0
]
ocr_text
,
ocr_score
=
ocr_res
[
0
][
0
]
if
ocr_score
>
0.5
and
len
(
ocr_text
)
>
0
:
if
ocr_score
>
0.5
and
len
(
ocr_text
)
>
0
:
...
...
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