refactor: 升级OCR依赖与适配rapidocr v3+,补充业务字段展示
主要变更: 1. 统一替换rapidocr-onnxruntime为rapidocr+onnxruntime依赖包 2. 适配rapidocr v3+ API变更:调整OCR结果解析逻辑 3. 补充展示员工岗位信息到OA审批通知 4. 优化OA详情链接格式为Markdown可点击样式 5. 修复OCR图片EXIF旋转问题与文件名解码 6. 新增RPA开发提成评分规则文档 7. 重构OA登录入口参数,简化调用逻辑 8. 删除临时测试脚本
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
|
||||
依赖(影刀「Python包管理」安装;启动校验不懒加载):
|
||||
pip install pyautogui pywin32 pyperclip psutil
|
||||
pip install Pillow numpy rapidocr-onnxruntime
|
||||
pip install Pillow numpy rapidocr onnxruntime
|
||||
|
||||
入口:
|
||||
main(messages) 影刀自定义指令调用入口,直接传列表,每项为 (search_keyword, text, verify_keyword) 元组:
|
||||
@@ -58,13 +58,13 @@ try:
|
||||
import psutil
|
||||
from PIL import Image, ImageGrab
|
||||
import numpy as np
|
||||
from rapidocr_onnxruntime import RapidOCR
|
||||
from rapidocr import RapidOCR
|
||||
except ImportError as _import_err:
|
||||
raise RuntimeError(
|
||||
"缺少必需依赖,无法启动(钉钉推送指令要求所有库在启动前装齐,不懒加载)。\n"
|
||||
"请先执行安装:\n"
|
||||
" pip install pyautogui pywin32 pyperclip psutil\n"
|
||||
" pip install Pillow numpy rapidocr-onnxruntime\n"
|
||||
" pip install Pillow numpy rapidocr onnxruntime\n"
|
||||
f"缺失依赖详情: {_import_err}"
|
||||
)
|
||||
|
||||
@@ -379,10 +379,10 @@ def _dt_ocr_image(img):
|
||||
if img is None:
|
||||
return []
|
||||
img_np = np.array(img)
|
||||
result, _ = _dt_get_ocr()(img_np)
|
||||
result = _dt_get_ocr()(img_np)
|
||||
ocr_data = []
|
||||
if result is not None:
|
||||
for box, text, score in result:
|
||||
if result is not None and result.boxes is not None:
|
||||
for box, text, score in zip(result.boxes, result.txts, result.scores):
|
||||
xs = [p[0] for p in box]
|
||||
ys = [p[1] for p in box]
|
||||
x1, y1 = min(xs), min(ys)
|
||||
|
||||
Reference in New Issue
Block a user