From ddaa85ddafe1edfbe618b83ca0e8e61dab33155b Mon Sep 17 00:00:00 2001 From: jzhang533 Date: Thu, 28 Mar 2024 11:43:15 +0800 Subject: [PATCH] Prepare 2.7.3 release (#11826) * fix: Correct misuse of `try_import` from `paddle.utils` (#11820) This commit addresses the incorrect usage of the `try_import` function from `paddle.utils` in both `ppocr/utils/utility.py` and `ppstructure/pdf2word/pdf2word.py`. * bump version to 2.7.3 --------- Co-authored-by: NeterOster --- paddleocr.py | 2 +- ppocr/utils/utility.py | 3 ++- ppstructure/pdf2word/pdf2word.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/paddleocr.py b/paddleocr.py index 0619300c88..8e4359df50 100644 --- a/paddleocr.py +++ b/paddleocr.py @@ -59,7 +59,7 @@ def _import_file(module_name, file_path, make_importable=False): ] SUPPORT_DET_MODEL = ['DB'] -VERSION = '2.7.2' +VERSION = '2.7.3' SUPPORT_REC_MODEL = ['CRNN', 'SVTR_LCNet'] BASE_DIR = os.path.expanduser("~/.paddleocr/") diff --git a/ppocr/utils/utility.py b/ppocr/utils/utility.py index 91b74f022d..05c92a8d0a 100755 --- a/ppocr/utils/utility.py +++ b/ppocr/utils/utility.py @@ -108,7 +108,8 @@ def check_and_read(img_path): return imgvalue, True, False elif os.path.basename(img_path)[-3:].lower() == 'pdf': from paddle.utils import try_import - try_import('fitz') + + fitz = try_import("fitz") from PIL import Image imgs = [] with fitz.open(img_path) as pdf: diff --git a/ppstructure/pdf2word/pdf2word.py b/ppstructure/pdf2word/pdf2word.py index d5d715ed66..2c21b661dd 100644 --- a/ppstructure/pdf2word/pdf2word.py +++ b/ppstructure/pdf2word/pdf2word.py @@ -21,9 +21,9 @@ import cv2 import platform import numpy as np -import fitz from paddle.utils import try_import -try_import('fitz') +fitz = try_import("fitz") + from PIL import Image from pdf2docx.converter import Converter from qtpy.QtWidgets import QApplication, QWidget, QPushButton, QProgressBar, \