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
zhougaofeng
magic_pdf
Commits
5513a575
Commit
5513a575
authored
Oct 25, 2024
by
zhougaofeng
Browse files
Update common.py
parent
ba10e53c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
magic_pdf/tools/common.py
magic_pdf/tools/common.py
+6
-5
No files found.
magic_pdf/tools/common.py
View file @
5513a575
...
...
@@ -48,7 +48,7 @@ def do_parse(
model_list
,
parse_method
,
debug_able
,
model
,
f_draw_span_bbox
=
True
,
f_draw_layout_bbox
=
True
,
f_dump_md
=
True
,
...
...
@@ -61,6 +61,7 @@ def do_parse(
start_page_id
=
0
,
end_page_id
=
None
,
):
if
debug_able
:
logger
.
warning
(
'debug mode is on'
)
...
...
@@ -76,13 +77,13 @@ def do_parse(
image_dir
=
str
(
os
.
path
.
basename
(
local_image_dir
))
if
parse_method
==
'auto'
:
jso_useful_key
=
{
'_pdf_type'
:
''
,
'model_list'
:
model_list
}
pipe
=
UNIPipe
(
pdf_bytes
,
jso_useful_key
,
image_writer
,
is_debug
=
Tru
e
,
pipe
=
UNIPipe
(
pdf_bytes
,
jso_useful_key
,
image_writer
,
is_debug
=
Fals
e
,
start_page_id
=
start_page_id
,
end_page_id
=
end_page_id
)
elif
parse_method
==
'txt'
:
pipe
=
TXTPipe
(
pdf_bytes
,
model_list
,
image_writer
,
is_debug
=
Tru
e
,
pipe
=
TXTPipe
(
pdf_bytes
,
model_list
,
image_writer
,
is_debug
=
Fals
e
,
start_page_id
=
start_page_id
,
end_page_id
=
end_page_id
)
elif
parse_method
==
'ocr'
:
pipe
=
OCRPipe
(
pdf_bytes
,
model_list
,
image_writer
,
is_debug
=
Tru
e
,
pipe
=
OCRPipe
(
pdf_bytes
,
model_list
,
image_writer
,
is_debug
=
Fals
e
,
start_page_id
=
start_page_id
,
end_page_id
=
end_page_id
)
else
:
logger
.
error
(
'unknown parse method'
)
...
...
@@ -93,7 +94,7 @@ def do_parse(
if
len
(
model_list
)
==
0
:
if
model_config
.
__use_inside_model__
:
pipe
.
pipe_analyze
()
pipe
.
pipe_analyze
(
model
)
orig_model_list
=
copy
.
deepcopy
(
pipe
.
model_list
)
else
:
logger
.
error
(
'need model list input'
)
...
...
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