Skip to content

Commit

Permalink
图片类型增加为jpeg/jpg/png
Browse files Browse the repository at this point in the history
  • Loading branch information
cuifengcn committed Jan 3, 2023
1 parent f1a2a4f commit 67fcc2c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions methods/image_ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

class ImageOcrClient:
def __init__(self):
self.model = CnOcr(
det_model_name="ch_PP-OCRv3_det",
)
self.model = CnOcr()

def start(self, keyword, logger=logging.getLogger()):
main_path = WORK_PATH.joinpath(keyword)
main_path.mkdir(exist_ok=True, parents=True)
files = glob.glob(str(main_path.joinpath("*.jpeg")))
files = (glob.glob(str(main_path.joinpath("*.jpeg"))) +
glob.glob(str(main_path.joinpath("*.jpg"))) +
glob.glob(str(main_path.joinpath("*.png"))))
target_path = main_path.joinpath("ocr")
target_path.mkdir(exist_ok=True)
for f in files:
Expand Down
4 changes: 3 additions & 1 deletion ui/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ def show_images(self):
self.images.clear()
self.ocrs.clear()
main_path = WORK_PATH.joinpath(self.keyword.value)
self.images.extend(glob.glob(str(main_path.joinpath("*.jpeg"))))
self.images.extend(glob.glob(str(main_path.joinpath("*.jpeg"))) +
glob.glob(str(main_path.joinpath("*.jpg"))) +
glob.glob(str(main_path.joinpath("*.png"))))
self.images.sort(key=lambda e: int(os.path.split(e)[-1].split(".")[0]))
self.index = 0
self._set_image()
Expand Down

0 comments on commit 67fcc2c

Please sign in to comment.