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