将ocr解析模块独立出来
This commit is contained in:
@@ -32,22 +32,6 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
_package = __package__
|
||||
except NameError:
|
||||
_package = None
|
||||
|
||||
if _package is None:
|
||||
# 直接运行时,添加父目录到路径并使用绝对导入
|
||||
parent_dir = Path(__file__).parent.parent
|
||||
if str(parent_dir) not in sys.path:
|
||||
sys.path.insert(0, str(parent_dir))
|
||||
from ocr.ocr import OCR, TextDetector, TextRecognizer
|
||||
from ocr.pdf_parser import SimplePdfParser
|
||||
else:
|
||||
# 作为模块导入时使用相对导入
|
||||
from .ocr import OCR, TextDetector, TextRecognizer
|
||||
from .pdf_parser import SimplePdfParser
|
||||
|
||||
__all__ = ['OCR', 'TextDetector', 'TextRecognizer', 'SimplePdfParser']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user