Hayk Arutyunyan commited on
Commit ·
d9372d5
1
Parent(s): 5543f69
Fix ocr_sensors function
Browse files- src/ocr_utils_demo.py +4 -4
src/ocr_utils_demo.py
CHANGED
|
@@ -55,7 +55,7 @@ def ocr_sensors(rois: list[np.ndarray]) -> list[dict]:
|
|
| 55 |
Формат вывода:
|
| 56 |
[{"text": str, "score": float}, ...]
|
| 57 |
"""
|
| 58 |
-
|
| 59 |
rois = []
|
| 60 |
|
| 61 |
if not rois:
|
|
@@ -63,13 +63,13 @@ def ocr_sensors(rois: list[np.ndarray]) -> list[dict]:
|
|
| 63 |
|
| 64 |
for roi in rois:
|
| 65 |
try:
|
| 66 |
-
|
| 67 |
except Exception as e:
|
| 68 |
print(f"⚠ Ошибка OCR.ocr: {e}")
|
| 69 |
return [{"text": "?", "score": 0.0} for _ in rois]
|
| 70 |
-
|
| 71 |
|
| 72 |
-
return
|
| 73 |
|
| 74 |
"""
|
| 75 |
|
|
|
|
| 55 |
Формат вывода:
|
| 56 |
[{"text": str, "score": float}, ...]
|
| 57 |
"""
|
| 58 |
+
results = []
|
| 59 |
rois = []
|
| 60 |
|
| 61 |
if not rois:
|
|
|
|
| 63 |
|
| 64 |
for roi in rois:
|
| 65 |
try:
|
| 66 |
+
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 |
+
results.append(result)
|
| 71 |
|
| 72 |
+
return results
|
| 73 |
|
| 74 |
"""
|
| 75 |
|