Spaces:
Runtime error
Runtime error
Update utility/utils.py
Browse files- utility/utils.py +3 -3
utility/utils.py
CHANGED
|
@@ -120,12 +120,12 @@ def ocr_with_paddle(img):
|
|
| 120 |
for line in result[0]:
|
| 121 |
# Check how many values are returned (2 or 3) and unpack accordingly
|
| 122 |
if len(line) == 3:
|
| 123 |
-
box, text, _ = line # When 3 values are returned
|
| 124 |
elif len(line) == 2:
|
| 125 |
-
box, text = line # When only 2 values are returned
|
| 126 |
|
| 127 |
# Store the recognized text and bounding boxes
|
| 128 |
-
final_text += ' ' + text
|
| 129 |
boxes.append(box)
|
| 130 |
|
| 131 |
# Draw the bounding box
|
|
|
|
| 120 |
for line in result[0]:
|
| 121 |
# Check how many values are returned (2 or 3) and unpack accordingly
|
| 122 |
if len(line) == 3:
|
| 123 |
+
box, (text, confidence), _ = line # When 3 values are returned
|
| 124 |
elif len(line) == 2:
|
| 125 |
+
box, (text, confidence) = line # When only 2 values are returned
|
| 126 |
|
| 127 |
# Store the recognized text and bounding boxes
|
| 128 |
+
final_text += ' ' + text # Extract the text from the tuple
|
| 129 |
boxes.append(box)
|
| 130 |
|
| 131 |
# Draw the bounding box
|