Commit 720db843 authored by myhloli's avatar myhloli

fix(demo): add fallback to internal model when external model data is...

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.
parent 46cacbc0
......@@ -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:
......
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