From e2ad93fd57000ddb92cd71331a4dd5fe30756cfb Mon Sep 17 00:00:00 2001 From: Benjamin Admin Date: Wed, 11 Mar 2026 00:16:31 +0100 Subject: [PATCH] fix: Word-Erkennung ohne Spalten ermoeglichen (Full-Page Pseudo-Column) Wenn column_result fehlt (z.B. OCR Overlay Pipeline), wird automatisch eine einzelne ganzseitige Pseudo-Spalte erzeugt statt einen Fehler zu werfen. Co-Authored-By: Claude Opus 4.6 --- klausur-service/backend/ocr_pipeline_api.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/klausur-service/backend/ocr_pipeline_api.py b/klausur-service/backend/ocr_pipeline_api.py index 0b0f157..998870a 100644 --- a/klausur-service/backend/ocr_pipeline_api.py +++ b/klausur-service/backend/ocr_pipeline_api.py @@ -1883,7 +1883,21 @@ async def detect_words( column_result = session.get("column_result") row_result = session.get("row_result") if not column_result or not column_result.get("columns"): - raise HTTPException(status_code=400, detail="Column detection must be completed first") + # No column detection — synthesize a single full-page pseudo-column. + # This enables the overlay pipeline which skips column detection. + img_h_tmp, img_w_tmp = dewarped_bgr.shape[:2] + column_result = { + "columns": [{ + "type": "column_text", + "x": 0, "y": 0, + "width": img_w_tmp, "height": img_h_tmp, + "classification_confidence": 1.0, + "classification_method": "full_page_fallback", + }], + "zones": [], + "duration_seconds": 0, + } + logger.info("detect_words: no column_result — using full-page pseudo-column %dx%d", img_w_tmp, img_h_tmp) if not row_result or not row_result.get("rows"): raise HTTPException(status_code=400, detail="Row detection must be completed first")