Unverified Commit d08fe271 authored by Xiaomeng Zhao's avatar Xiaomeng Zhao Committed by GitHub
Browse files

Merge pull request #1553 from myhloli/dev

fix(magic_pdf): correct end page index and improve error handling
parents 2aea5d6f f209ddea
......@@ -158,7 +158,7 @@ def doc_analyze(
table_enable=None,
) -> InferenceResult:
end_page_id = end_page_id if end_page_id else len(dataset)
end_page_id = end_page_id if end_page_id else len(dataset) - 1
model_manager = ModelSingleton()
custom_model = model_manager.get_model(
......
......@@ -151,7 +151,7 @@ Corrected title list:
logger.warning("The number of titles in the optimized result is not equal to the number of titles in the input.")
retry_count += 1
except Exception as e:
if e is json.JSONDecodeError:
if isinstance(e, json.decoder.JSONDecodeError):
logger.warning(f"JSON decode error on attempt {retry_count + 1}: {e}")
else:
logger.exception(e)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment