From 35bf6649be6632f52ec72538509e8c89502c70df Mon Sep 17 00:00:00 2001 From: AuroraWright Date: Fri, 13 Dec 2024 17:14:44 +0100 Subject: [PATCH] Silence new manga_ocr warnings, prevent autopausing when recognition takes a long time --- owocr/ocr.py | 3 ++- owocr/run.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/owocr/ocr.py b/owocr/ocr.py index ad453c4..27fb617 100644 --- a/owocr/ocr.py +++ b/owocr/ocr.py @@ -112,6 +112,7 @@ class MangaOcr: logger.warning('manga-ocr not available, Manga OCR will not work!') else: logger.disable('manga_ocr') + logging.getLogger('transformers').setLevel(logging.ERROR) # silence transformers >=4.46 warnings from manga_ocr import ocr ocr.post_process = empty_post_process logger.info(f'Loading Manga OCR model') @@ -563,4 +564,4 @@ class RapidOCR: return x def _preprocess(self, img): - return pil_image_to_numpy_array(img) \ No newline at end of file + return pil_image_to_numpy_array(img) diff --git a/owocr/run.py b/owocr/run.py index 95c5b03..fd826bd 100644 --- a/owocr/run.py +++ b/owocr/run.py @@ -515,6 +515,9 @@ def are_images_identical(img1, img2): def process_and_write_results(img_or_path, write_to, notifications, last_result, filtering): + if auto_pause_handler and not paused: + auto_pause_handler.stop() + engine_instance = engine_instances[engine_index] t0 = time.time() res, text = engine_instance(img_or_path)