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`.
This commit is contained in:
NeterOster 2024-03-28 11:26:36 +08:00 committed by GitHub
parent 454ed3faa2
commit fa93f61cc5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 3 deletions

View File

@ -120,7 +120,7 @@ def check_and_read(img_path):
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 = []

View File

@ -21,10 +21,9 @@ import functools
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 (