From d08a9f3b8d9754ddb33a3306558239a9dfa0abd9 Mon Sep 17 00:00:00 2001 From: Edward Delaporte Date: Mon, 23 Feb 2026 20:52:10 -0600 Subject: [PATCH 1/1] Skip already processed files --- files/ocr/ocr.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/files/ocr/ocr.py b/files/ocr/ocr.py index 795a83b..61a69ba 100644 --- a/files/ocr/ocr.py +++ b/files/ocr/ocr.py @@ -27,9 +27,12 @@ def ocr_directory(input_dir): input_path = os.path.join(root, file_name) output_path = os.path.join(root, file_name.replace('.', '_ocr.')) - # Perform OCR on the image - text = ocr_image(ocr, input_path) - + text = None + if os.path.exists(output_path): + print(f'{output_path} exists.') + else: + # Perform OCR on the image + text = ocr_image(ocr, input_path) if text: # Write the OCR result to a JSON file json_output_path = output_path.rsplit('.', 1)[0] + '.json' -- 2.47.3