Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

fix(demo): add fallback to internal model when external model data is missingIf no valid model data is provided, the system now checks if an internal model should be used. This enhances the robustness of the demo pipeline by providing a default behavior when essential data is not available.

myhloli720db843c54a
diff --git a/demo/demo.py b/demo/demo.py
index 35d95632..eb3eca1b 100644
--- a/demo/demo.py
+++ b/demo/demo.py
@@ -23,6 +23,13 @@ try:
image_writer = DiskReaderWriter(local_image_dir)
pipe = UNIPipe(pdf_bytes, jso_useful_key, image_writer)
pipe.pipe_classify()
+ """如果没有传入有效的模型数据,则使用内置model解析"""
+ if len(model_json) == 0:
+ if model_config.__use_inside_model__:
+ pipe.pipe_analyze()
+ else:
+ logger.error("need model list input")
+ exit(1)
pipe.pipe_parse()
md_content = pipe.pipe_mk_markdown(image_dir, drop_mode="none")
with open(f"{demo_name}.md", "w", encoding="utf-8") as f: