Skip to content

Commit

Permalink
fix: Correct misuse of try_import from paddle.utils (#11820)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
neteroster authored Mar 28, 2024
1 parent 454ed3f commit fa93f61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ppocr/utils/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
3 changes: 1 addition & 2 deletions ppstructure/pdf2word/pdf2word.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +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 (
Expand Down

0 comments on commit fa93f61

Please sign in to comment.