From 10024a66c30f8fdddbefdfd5395159bc8fcf2093 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 30 May 2026 14:34:37 +0700 Subject: [PATCH] 690530:1434 ADR-030-231-ocr-sandbox-two-step-flow #05.2 [skip ci] --- .../04-00-docker-compose/Desk-5439/ocr-sidecar/app.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/04-Infrastructure-OPS/04-00-docker-compose/Desk-5439/ocr-sidecar/app.py b/specs/04-Infrastructure-OPS/04-00-docker-compose/Desk-5439/ocr-sidecar/app.py index 144d8e76..ab4fa6b9 100644 --- a/specs/04-Infrastructure-OPS/04-00-docker-compose/Desk-5439/ocr-sidecar/app.py +++ b/specs/04-Infrastructure-OPS/04-00-docker-compose/Desk-5439/ocr-sidecar/app.py @@ -33,9 +33,9 @@ app = FastAPI(title="Tesseract OCR Sidecar", version="1.0.0") OCR_CHAR_THRESHOLD = int(os.getenv("OCR_CHAR_THRESHOLD", "100")) MAX_PAGES = int(os.getenv("OCR_MAX_PAGES", "0")) # 0 = ทุกหน้า OCR_LANG = os.getenv("OCR_LANG", "tha+eng") # Tesseract language code (tha+eng = Thai + English) -# PSM 6 = Assume single uniform block of text (เหมาะกับเอกสารที่มี header/footer) +# PSM 3 = Fully automatic page segmentation (เหมาะกับเอกสารที่มี layout หลายส่วน เช่น วันที่/เลขที่) # OEM 1 = LSTM only (ดีกว่า legacy engine) -TESSERACT_CONFIG = f"--psm 6 --oem 1" +TESSERACT_CONFIG = f"--psm 3 --oem 1" # Crop margin: ตัด header/footer (บน 10%, ล่าง 10%) CROP_TOP_RATIO = 0.10 CROP_BOTTOM_RATIO = 0.02