fix: guard paddleocr confidence parsing
Browse files
app.py
CHANGED
|
@@ -194,8 +194,12 @@ def ocr_and_parse(image: Image.Image) -> Dict[str, Any]:
|
|
| 194 |
text = str(text_info)
|
| 195 |
elif len(entry) >= 3:
|
| 196 |
text = entry[1] or ""
|
| 197 |
-
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
|
| 200 |
cleaned = text.strip()
|
| 201 |
if not cleaned:
|
|
|
|
| 194 |
text = str(text_info)
|
| 195 |
elif len(entry) >= 3:
|
| 196 |
text = entry[1] or ""
|
| 197 |
+
raw_conf = entry[2]
|
| 198 |
+
try:
|
| 199 |
+
if raw_conf is not None:
|
| 200 |
+
confidence = float(raw_conf)
|
| 201 |
+
except (TypeError, ValueError):
|
| 202 |
+
confidence = 1.0
|
| 203 |
|
| 204 |
cleaned = text.strip()
|
| 205 |
if not cleaned:
|