diff --git a/ocr.py b/ocr.py index ec36150a48d77f7adefde8a1d78c972da34cc6cb..6f9d4266608898827bc8835a313ceca9773052fd 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