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
fc5f330c
Commit
fc5f330c
authored
Jun 30, 2025
by
myhloli
Browse files
fix: handle exceptions in parsing and return None on failure
parent
e13b0a70
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
mineru/cli/gradio_app.py
mineru/cli/gradio_app.py
+17
-0
No files found.
mineru/cli/gradio_app.py
View file @
fc5f330c
...
@@ -28,6 +28,7 @@ async def parse_pdf(doc_path, output_dir, end_page_id, is_ocr, formula_enable, t
...
@@ -28,6 +28,7 @@ async def parse_pdf(doc_path, output_dir, end_page_id, is_ocr, formula_enable, t
if
backend
.
startswith
(
"vlm"
):
if
backend
.
startswith
(
"vlm"
):
parse_method
=
"vlm"
parse_method
=
"vlm"
url
=
None
local_image_dir
,
local_md_dir
=
prepare_env
(
output_dir
,
file_name
,
parse_method
)
local_image_dir
,
local_md_dir
=
prepare_env
(
output_dir
,
file_name
,
parse_method
)
await
aio_do_parse
(
await
aio_do_parse
(
output_dir
=
output_dir
,
output_dir
=
output_dir
,
...
@@ -44,6 +45,7 @@ async def parse_pdf(doc_path, output_dir, end_page_id, is_ocr, formula_enable, t
...
@@ -44,6 +45,7 @@ async def parse_pdf(doc_path, output_dir, end_page_id, is_ocr, formula_enable, t
return
local_md_dir
,
file_name
return
local_md_dir
,
file_name
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
e
)
logger
.
exception
(
e
)
return
None
def
compress_directory_to_zip
(
directory_path
,
output_zip_path
):
def
compress_directory_to_zip
(
directory_path
,
output_zip_path
):
...
@@ -175,6 +177,21 @@ def to_pdf(file_path):
...
@@ -175,6 +177,21 @@ def to_pdf(file_path):
def
main
():
def
main
():
example_enable
=
False
example_enable
=
False
# try:
# print("Start init SgLang engine...")
# from mineru.backend.vlm.vlm_analyze import ModelSingleton
# modelsingleton = ModelSingleton()
# predictor = modelsingleton.get_model(
# "sglang-engine",
# None,
# None,
# mem_fraction_static=0.5,
# enable_torch_compile=True,
# )
# print("SgLang engine init successfully.")
# except Exception as e:
# logger.exception(e)
with
gr
.
Blocks
()
as
demo
:
with
gr
.
Blocks
()
as
demo
:
gr
.
HTML
(
header
)
gr
.
HTML
(
header
)
with
gr
.
Row
():
with
gr
.
Row
():
...
...
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