diff --git a/arknights_mower/utils/paddleocr.py b/arknights_mower/utils/paddleocr.py deleted file mode 100644 index c129e21a5..000000000 --- a/arknights_mower/utils/paddleocr.py +++ /dev/null @@ -1,21 +0,0 @@ -from .path import get_path - -ocr = None - -def initialize_ocr(): - global ocr - if not ocr: - from paddleocr import PaddleOCR - - det_model_dir = get_path("@app/tmp/paddle/det/ch", space='') - rec_model_dir = get_path("@app/tmp/paddle/rec/ch", space='') - cls_model_dir = get_path("@app/tmp/paddle/cls", space='') - ocr = PaddleOCR( - enable_mkldnn=False, - use_angle_cls=False, - cls=False, - show_log=False, - det_model_dir=str(det_model_dir), - rec_model_dir=str(rec_model_dir), - cls_model_dir=str(cls_model_dir), - ) diff --git a/diy.py b/diy.py index 659be14ac..c1037fe10 100644 --- a/diy.py +++ b/diy.py @@ -9,12 +9,9 @@ from arknights_mower.utils.device import Device from arknights_mower.utils.email import task_template from arknights_mower.utils.log import logger, init_fhlr -from arknights_mower.utils import config -from arknights_mower.utils.logic_expression import LogicExpression +from arknights_mower.utils import config, rapidocr from arknights_mower.utils.simulator import restart_simulator from arknights_mower.utils.plan import Plan, PlanConfig, Room -import arknights_mower.utils.paddleocr - # 下面不能删除 from arknights_mower.utils.operators import Operators, Operator, Dormitory from arknights_mower.utils.scheduler_task import SchedulerTask,TaskTypes @@ -380,7 +377,7 @@ def simulate(): continue base_scheduler.run() reconnect_tries = 0 - except ConnectionError or ConnectionAbortedError or AttributeError as e: + except (ConnectionError, ConnectionAbortedError, AttributeError) as e: reconnect_tries += 1 if reconnect_tries < reconnect_max_tries: logger.warning(f'连接端口断开....正在重连....') @@ -389,7 +386,7 @@ def simulate(): try: base_scheduler = inialize([], base_scheduler) break - except RuntimeError or ConnectionError or ConnectionAbortedError as ce: + except (ConnectionError, ConnectionAbortedError, AttributeError) as ce: logger.error(ce) restart_simulator(simulator) continue @@ -411,5 +408,5 @@ def simulate(): # debuglog() atexit.register(save_state) savelog() -arknights_mower.utils.paddleocr.initialize_ocr() +rapidocr.initialize_ocr() simulate()