Skip to content

πŸ“„ Awesome OCR multiple programing languages toolkits based on ONNX Runtime, OpenVINO, MNN, PaddlePaddle, TensorRT and PyTorch.

fix(rapidocr): fixed windows 2022Server parse int exception (#366)

ok-oldking0a030b9b62a8
diff --git a/python/rapidocr/inference_engine/onnxruntime.py b/python/rapidocr/inference_engine/onnxruntime.py
index 265bc4e..b42447c 100644
--- a/python/rapidocr/inference_engine/onnxruntime.py
+++ b/python/rapidocr/inference_engine/onnxruntime.py
@@ -151,7 +151,9 @@ class OrtInferSession(InferSession):
)
return False
- cur_window_version = int(platform.release().split(".")[0])
+ cur_window_version_str = platform.release().split(".")[0]
+ cur_window_version = int(cur_window_version_str) if cur_window_version_str.isdigit() else 0
+
if cur_window_version < 10:
self.logger.warning(
"DirectML is only supported in Windows 10 and above OS. The current Windows version is %s. Use %s inference by default.",