From 0be760987c17d183f0237c25625a844a567c8dc5 Mon Sep 17 00:00:00 2001 From: wuzekai <3025054974@qq.com> Date: Tue, 8 Jul 2025 05:20:08 +0000 Subject: [PATCH] Update ocr.py --- ocr.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ocr.py b/ocr.py index ec36150..6f9d426 100644 --- a/ocr.py +++ b/ocr.py @@ -33,4 +33,16 @@ def ocr_inference(): uuid_str = str(uuid.uuid4()) filename = f"{uuid_str}.jpg" image_path = os.path.join(upload_dir, filename) - file.save(image_path) \ No newline at end of file + file.save(image_path) + + try: + # 调用 OCR 模型并捕获 stdout + command = [ + "python", + "tools/infer/predict_system.py", + "--image_dir", image_path, + "--det_model_dir", det_model_dir, + "--rec_model_dir", rec_model_dir, + "--cls_model_dir", cls_model_dir, + "--draw_img_save_dir", result_dir, + ] \ No newline at end of file -- 2.22.0