Hayk Arutyunyan commited on
Commit
5543f69
·
1 Parent(s): baa8934

Fix ocr_sensors function

Browse files
Files changed (1) hide show
  1. src/ocr_utils_demo.py +14 -9
src/ocr_utils_demo.py CHANGED
@@ -55,17 +55,23 @@ def ocr_sensors(rois: list[np.ndarray]) -> list[dict]:
55
  Формат вывода:
56
  [{"text": str, "score": float}, ...]
57
  """
58
- results = []
 
59
 
60
  if not rois:
61
  return results
62
 
63
- try:
64
- ocr_results = paddle_ocr.ocr(rois)
65
- print(ocr_results) # для отладки
66
- except Exception as e:
67
- print(f"⚠ Ошибка OCR.predict: {e}")
68
- return [{"text": "?", "score": 0.0} for _ in rois]
 
 
 
 
 
69
 
70
  for out in ocr_results:
71
 
@@ -77,5 +83,4 @@ def ocr_sensors(rois: list[np.ndarray]) -> list[dict]:
77
  score = scores[0] if scores else 0.0
78
 
79
  results.append({"text": text, "score": round(score, 2)})
80
-
81
- return results
 
55
  Формат вывода:
56
  [{"text": str, "score": float}, ...]
57
  """
58
+ ocr_results = []
59
+ rois = []
60
 
61
  if not rois:
62
  return results
63
 
64
+ for roi in rois:
65
+ try:
66
+ ocr_result = paddle_ocr.ocr(roi)
67
+ except Exception as e:
68
+ print(f"⚠ Ошибка OCR.ocr: {e}")
69
+ return [{"text": "?", "score": 0.0} for _ in rois]
70
+ ocr_results.append(ocr_result)
71
+
72
+ return ocr_results
73
+
74
+ """
75
 
76
  for out in ocr_results:
77
 
 
83
  score = scores[0] if scores else 0.0
84
 
85
  results.append({"text": text, "score": round(score, 2)})
86
+ """