import sys
sys.path.insert(0, ".")
from pathlib import Path
from PIL import Image
import src.common.vision_ocr as vision_ocr

p = Path("captures/pipeline_run/20260920_055832_346_STAGE2_MAP_DEVICE_VIEW.png")
img = Image.open(p)
res = vision_ocr.safe_recognize_pil_sync(img)
for l in res.get("lines", []):
    txt = l.get("text", "")
    words = l.get("words", [])
    word_str = ", ".join([f"{w.get('text')}@({w.get('bounding_rect',{}).get('x')},{w.get('bounding_rect',{}).get('y')})" for w in words])
    print(f"Line: '{txt}' -> Words: {word_str}")
