Skip to content

Commit

Permalink
Merge pull request #106 from ctripcorp/105-依赖包安装优化
Browse files Browse the repository at this point in the history
105 依赖包安装优化
  • Loading branch information
clgwlg authored Aug 23, 2022
2 parents 161452b + 854ff83 commit a0b10a0
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion flybirds/template/config/flybirds_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}}",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions requirements_ml.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
paddleocr>=2.5.0
paddlepaddle>=2.3.0
protobuf==3.20.1
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
tool setup
"""
from setuptools import setup, find_packages
import sys


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")
Expand Down

0 comments on commit a0b10a0

Please sign in to comment.