ForcePilot/scripts/paddlestructure/example_usage.py
Wenjie Zhang eeb53f4774 feat: 添加 PaddleX OCR 支持及示例更新
- 在 example_usage.py 中更新分析文档的示例,使用新的 PaddleX OCR 服务。
- 在 data_router.py 中优化文件处理反馈信息,增加处理失败文件的统计。
- 在 indexing.py 中新增对 PaddleX OCR 的支持。
- 在 _ocr.py 中添加 process_pdf_paddlex 方法,集成 PaddleX OCR 处理逻辑。
- 新增 paddlex.py 文件,封装 PaddleX 版面解析服务的 API 调用。
- 更新前端 DataBaseInfoView.vue,增加 PaddleX OCR 选项。
- 新增测试文件 PixPin_2025-06-19_23-42-17.png 以支持 OCR 测试。
2025-06-23 10:09:51 +08:00

33 lines
846 B
Python

#!/usr/bin/env python3
"""
PaddleX 文档分析使用示例
演示如何使用 analyze_document 函数分析文档
"""
from src.plugins.paddlex import analyze_document
import json
def analyze_custom_file(file_path: str):
"""分析自定义文件的示例函数"""
print(f"\n🔍 分析自定义文件: {file_path}")
result = analyze_document(file_path=file_path, base_url="http://172.19.13.5:8080")
if result["success"]:
return result
else:
print(f"❌ 分析失败: {result['error']}")
return None
if __name__ == "__main__":
# main()
# 如果您想分析其他文件,可以取消注释下面的代码
custom_file = "test/data/ocr_test/1706.03762v7_扫描版.pdf"
custom_file = "test/data/ocr_test/PixPin_2025-06-19_23-42-17.png"
print(analyze_custom_file(custom_file))