Silence new manga_ocr warnings, prevent autopausing when recognition takes a long time

This commit is contained in:
AuroraWright
2024-12-13 17:14:44 +01:00
parent 5bf39b4f61
commit 35bf6649be
2 changed files with 5 additions and 1 deletions

View File

@@ -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)
return pil_image_to_numpy_array(img)

View File

@@ -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)