import paddleocr from PIL import Image from pathlib import Path # Find the latest page 4 image img_path = next(Path("output").glob("20260612_003429/pages/page_004.png")) print(f"Running PaddleOCR on {img_path}") ocr = paddleocr.PaddleOCR(lang='te') result = ocr.predict(str(img_path)) print("OCR lines on Page 4 containing 'చెరువు' or 'మంత్రి' or numbers:") if isinstance(result, list) and len(result) > 0: det_result = result[0] # Check if it has boxes and texts texts = det_result.get('rec_texts', []) boxes = det_result.get('dt_polys', []) for i, txt in enumerate(texts): if any(w in txt for w in ["చెరువు", "మంత్రి", "36", "ఏళ్ల", "ఉత్తమ్", "పల్లా", "సిద్ధపేట", "గూడెం"]): box = boxes[i].tolist() if hasattr(boxes[i], 'tolist') else boxes[i] print(f"Text: '{txt}' at box: {box}")