|
|
@@ -7,10 +7,13 @@ import tempfile
|
|
|
from pathlib import Path
|
|
|
from PIL import Image
|
|
|
|
|
|
-from .data_processor import parse_ocr_data
|
|
|
from .config_loader import load_structure_from_config
|
|
|
from .drawing import clear_table_image_cache
|
|
|
|
|
|
+try:
|
|
|
+ from table_line_generator import TableLineGenerator
|
|
|
+except ImportError:
|
|
|
+ from ..table_line_generator import TableLineGenerator
|
|
|
|
|
|
def handle_json_upload(uploaded_json):
|
|
|
"""处理 JSON 文件上传"""
|
|
|
@@ -34,7 +37,7 @@ def handle_json_upload(uploaded_json):
|
|
|
else:
|
|
|
st.json(raw_data[:3] if len(raw_data) > 3 else raw_data)
|
|
|
|
|
|
- ocr_data = parse_ocr_data(raw_data)
|
|
|
+ ocr_data = TableLineGenerator.parse_ocr_data(raw_data, tool="ppstructv3")
|
|
|
|
|
|
if not ocr_data:
|
|
|
st.error("❌ 无法解析 OCR 数据,请检查 JSON 格式")
|