Rivalcoder commited on
Commit
4b32c6f
Β·
1 Parent(s): 8029506
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -39,11 +39,15 @@ def run_ocr_on_image(image: Image.Image):
39
  """Convert PIL β†’ numpy and run OCR"""
40
  image_np = np.array(image)
41
  results = reader.readtext(image_np)
 
42
  text_results = []
43
  for bbox, text, prob in results:
 
 
 
44
  text_results.append({
45
- "bbox": bbox,
46
- "text": text,
47
  "confidence": float(prob)
48
  })
49
  return text_results
 
39
  """Convert PIL β†’ numpy and run OCR"""
40
  image_np = np.array(image)
41
  results = reader.readtext(image_np)
42
+
43
  text_results = []
44
  for bbox, text, prob in results:
45
+ # βœ… convert bbox coords to plain Python floats
46
+ bbox_py = [[float(x), float(y)] for x, y in bbox]
47
+
48
  text_results.append({
49
+ "bbox": bbox_py,
50
+ "text": str(text),
51
  "confidence": float(prob)
52
  })
53
  return text_results