Fix PaddleOCR call (remove cls arg)
Browse files
app.py
CHANGED
|
@@ -9,15 +9,15 @@ def run_ocr(img):
|
|
| 9 |
if img is None:
|
| 10 |
return "", 0.0
|
| 11 |
|
| 12 |
-
|
| 13 |
-
img_np = np.array(img)
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
|
| 17 |
lines = []
|
| 18 |
confs = []
|
| 19 |
|
| 20 |
-
# result
|
| 21 |
for block in result:
|
| 22 |
for item in block:
|
| 23 |
text, conf = item[1]
|
|
|
|
| 9 |
if img is None:
|
| 10 |
return "", 0.0
|
| 11 |
|
| 12 |
+
img_np = np.array(img) # PIL -> numpy (RGB)
|
|
|
|
| 13 |
|
| 14 |
+
# No cls arg here (handled by use_angle_cls=True above)
|
| 15 |
+
result = ocr.ocr(img_np)
|
| 16 |
|
| 17 |
lines = []
|
| 18 |
confs = []
|
| 19 |
|
| 20 |
+
# result is typically: [ [ [box], (text, conf) ], ... ]
|
| 21 |
for block in result:
|
| 22 |
for item in block:
|
| 23 |
text, conf = item[1]
|