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
11bf98d0
Unverified
Commit
11bf98d0
authored
Apr 30, 2025
by
Xiaomeng Zhao
Committed by
GitHub
Apr 30, 2025
Browse files
Merge pull request #2411 from CharlesKeeling65/patch-1
Update app.py: Fix parameter parsing in /file_parse endpoint
parents
f0b66d3a
862891e2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
projects/web_api/app.py
projects/web_api/app.py
+10
-8
No files found.
projects/web_api/app.py
View file @
11bf98d0
...
@@ -21,6 +21,7 @@ from magic_pdf.libs.config_reader import get_bucket_name, get_s3_config
...
@@ -21,6 +21,7 @@ from magic_pdf.libs.config_reader import get_bucket_name, get_s3_config
from
magic_pdf.model.doc_analyze_by_custom_model
import
doc_analyze
from
magic_pdf.model.doc_analyze_by_custom_model
import
doc_analyze
from
magic_pdf.operators.models
import
InferenceResult
from
magic_pdf.operators.models
import
InferenceResult
from
magic_pdf.operators.pipes
import
PipeResult
from
magic_pdf.operators.pipes
import
PipeResult
from
fastapi
import
Form
model_config
.
__use_inside_model__
=
True
model_config
.
__use_inside_model__
=
True
...
@@ -102,6 +103,7 @@ def init_writers(
...
@@ -102,6 +103,7 @@ def init_writers(
# 处理上传的文件
# 处理上传的文件
file_bytes
=
file
.
file
.
read
()
file_bytes
=
file
.
file
.
read
()
file_extension
=
os
.
path
.
splitext
(
file
.
filename
)[
1
]
file_extension
=
os
.
path
.
splitext
(
file
.
filename
)[
1
]
writer
=
FileBasedDataWriter
(
output_path
)
writer
=
FileBasedDataWriter
(
output_path
)
image_writer
=
FileBasedDataWriter
(
output_image_path
)
image_writer
=
FileBasedDataWriter
(
output_image_path
)
os
.
makedirs
(
output_image_path
,
exist_ok
=
True
)
os
.
makedirs
(
output_image_path
,
exist_ok
=
True
)
...
@@ -176,14 +178,14 @@ def encode_image(image_path: str) -> str:
...
@@ -176,14 +178,14 @@ def encode_image(image_path: str) -> str:
)
)
async
def
file_parse
(
async
def
file_parse
(
file
:
UploadFile
=
None
,
file
:
UploadFile
=
None
,
file_path
:
str
=
None
,
file_path
:
str
=
Form
(
None
)
,
parse_method
:
str
=
"auto"
,
parse_method
:
str
=
Form
(
"auto"
)
,
is_json_md_dump
:
bool
=
False
,
is_json_md_dump
:
bool
=
Form
(
False
)
,
output_dir
:
str
=
"output"
,
output_dir
:
str
=
Form
(
"output"
)
,
return_layout
:
bool
=
False
,
return_layout
:
bool
=
Form
(
False
)
,
return_info
:
bool
=
False
,
return_info
:
bool
=
Form
(
False
)
,
return_content_list
:
bool
=
False
,
return_content_list
:
bool
=
Form
(
False
)
,
return_images
:
bool
=
False
,
return_images
:
bool
=
Form
(
False
)
,
):
):
"""
"""
Execute the process of converting PDF to JSON and MD, outputting MD and JSON files
Execute the process of converting PDF to JSON and MD, outputting MD and JSON files
...
...
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