From e693619888cacd00c4b40be0ab23880d345ae0f3 Mon Sep 17 00:00:00 2001 From: WenmuZhou <572459439@qq.com> Date: Wed, 23 Mar 2022 14:14:33 +0000 Subject: [PATCH] add relative import --- __init__.py | 6 ++++-- paddleocr.py | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/__init__.py b/__init__.py index e22e466a..15a9aca4 100644 --- a/__init__.py +++ b/__init__.py @@ -11,8 +11,10 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import paddleocr from .paddleocr import * __version__ = paddleocr.VERSION -__all__ = ['PaddleOCR', 'PPStructure', 'draw_ocr', 'draw_structure_result', 'save_structure_res','download_with_progressbar'] +__all__ = [ + 'PaddleOCR', 'PPStructure', 'draw_ocr', 'draw_structure_result', + 'save_structure_res', 'download_with_progressbar' +] diff --git a/paddleocr.py b/paddleocr.py index c550fc5e..ffe28d00 100644 --- a/paddleocr.py +++ b/paddleocr.py @@ -11,9 +11,11 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import absolute_import import os import sys +import importlib __dir__ = os.path.dirname(__file__) @@ -26,6 +28,10 @@ import logging import numpy as np from pathlib import Path +tools = importlib.import_module('.', 'tools') +ppocr = importlib.import_module('.', 'ppocr') +ppstructure = importlib.import_module('.', 'ppstructure') + from tools.infer import predict_system from ppocr.utils.logging import get_logger @@ -42,7 +48,7 @@ __all__ = [ ] SUPPORT_DET_MODEL = ['DB'] -VERSION = '2.4.0.2' +VERSION = '2.4.0.3' SUPPORT_REC_MODEL = ['CRNN'] BASE_DIR = os.path.expanduser("~/.paddleocr/") -- GitLab