From d647b8a910af4dafe29d747ab4ada832156e323b Mon Sep 17 00:00:00 2001 From: clgwlg Date: Tue, 23 Aug 2022 16:23:43 +0800 Subject: [PATCH 1/3] feat:not install ML package in windows platform --- .../default/ui_driver/paddleocr/ocr_manage.py | 14 ++++++++------ .../plugins/default/ui_driver/poco/findsnap.py | 2 +- flybirds/template/config/flybirds_config.json | 2 +- requirements.txt | 2 +- setup.py | 8 +++++++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/flybirds/core/plugin/plugins/default/ui_driver/paddleocr/ocr_manage.py b/flybirds/core/plugin/plugins/default/ui_driver/paddleocr/ocr_manage.py index f84c90a3..4a1fbc01 100644 --- a/flybirds/core/plugin/plugins/default/ui_driver/paddleocr/ocr_manage.py +++ b/flybirds/core/plugin/plugins/default/ui_driver/paddleocr/ocr_manage.py @@ -14,11 +14,13 @@ def ocr_init(lang=None): ocr_lang = gr.get_app_config_value("ocr_lang") else: ocr_lang = lang - from paddleocr import PaddleOCR - # Paddleocr support languages - # example`ch`, `en`, `fr`, `german`, `korean`, `japan` - ocr = PaddleOCR(use_angle_cls=True, - lang=ocr_lang) # need to run only once to download and load model into memory - return ocr + if ocr_lang != "": + from paddleocr import PaddleOCR + # Paddleocr support languages + # example`ch`, `en`, `fr`, `german`, `korean`, `japan` + ocr = PaddleOCR(use_angle_cls=True, + lang=ocr_lang) # need to run only once to download and load model into memory + + return ocr diff --git a/flybirds/core/plugin/plugins/default/ui_driver/poco/findsnap.py b/flybirds/core/plugin/plugins/default/ui_driver/poco/findsnap.py index ff490d21..cd32469d 100644 --- a/flybirds/core/plugin/plugins/default/ui_driver/poco/findsnap.py +++ b/flybirds/core/plugin/plugins/default/ui_driver/poco/findsnap.py @@ -60,7 +60,7 @@ def snap_find(source, config): name: name, id textMatches: Regular """ - print("config", config) + # print("config", config) text = config.get("text") name = config.get("name") textMatches = config.get("textMatches") diff --git a/flybirds/template/config/flybirds_config.json b/flybirds/template/config/flybirds_config.json index 177baae6..7c60a553 100644 --- a/flybirds/template/config/flybirds_config.json +++ b/flybirds/template/config/flybirds_config.json @@ -4,7 +4,7 @@ "packagePath": "https://download2.ctrip.com/html5/Ctrip_V8.43.0_SIT4-100053_Product_9725895.apk", "overwriteInstallation": false, "uniqueTag": "", - "ocrLang": "ch" + "ocrLang": "" }, "device_info": { "deviceId": "%{{deviceId}}", diff --git a/requirements.txt b/requirements.txt index 8055d548..4a4e5c0f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ pyOpenSSL==19.1.0 click==8.0.3 jsonpath_ng>=1.5.3 deepdiff>=5.8.1 -numpy==1.22.4 +numpy<1.23 paddleocr>=2.5.0 paddlepaddle>=2.3.0 protobuf==3.20.1 diff --git a/setup.py b/setup.py index 5e0d3562..4432eef9 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ tool setup """ from setuptools import setup, find_packages +import sys def parse_requirements(filename): @@ -11,7 +12,12 @@ def parse_requirements(filename): get requirements list from config file """ line_iter = (line.strip() for line in open(filename)) - return [line for line in line_iter if line and not line.startswith("#")] + reqs = [line for line in line_iter if line and not line.startswith("#")] + if sys.platform == "win32": + reqs.remove("paddleocr>=2.5.0") + reqs.remove("paddlepaddle>=2.3.0") + reqs.remove("protobuf==3.20.1") + return reqs req = parse_requirements("requirements.txt") From 6be6f9dc49f93c23cbb5b1b6bc2ec878561358d2 Mon Sep 17 00:00:00 2001 From: clgwlg Date: Tue, 23 Aug 2022 16:29:11 +0800 Subject: [PATCH 2/3] feat:add ml install txt --- ml.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 ml.txt diff --git a/ml.txt b/ml.txt new file mode 100644 index 00000000..94ea5e9c --- /dev/null +++ b/ml.txt @@ -0,0 +1,3 @@ +paddleocr>=2.5.0 +paddlepaddle>=2.3.0 +protobuf==3.20.1 \ No newline at end of file From 854ff83784c8fe3890ad2f2a5e8511595bd4996a Mon Sep 17 00:00:00 2001 From: clgwlg Date: Tue, 23 Aug 2022 16:31:02 +0800 Subject: [PATCH 3/3] chore:change file name --- ml.txt => requirements_ml.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ml.txt => requirements_ml.txt (100%) diff --git a/ml.txt b/requirements_ml.txt similarity index 100% rename from ml.txt rename to requirements_ml.txt