Spaces:
Sleeping
Sleeping
New standalone file
Browse files- paddle_ocr_standalone.py +7 -2
paddle_ocr_standalone.py
CHANGED
|
@@ -226,8 +226,13 @@ try:
|
|
| 226 |
for line_idx, line in enumerate(result[0]):
|
| 227 |
try:
|
| 228 |
if len(line) >= 2:
|
| 229 |
-
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
|
| 232 |
safe_print_stderr(f"Line {line_idx}: '{text_content}' (confidence: {confidence:.2f})")
|
| 233 |
|
|
|
|
| 226 |
for line_idx, line in enumerate(result[0]):
|
| 227 |
try:
|
| 228 |
if len(line) >= 2:
|
| 229 |
+
# Handle both string and float text values
|
| 230 |
+
if isinstance(line[1], (list, tuple)):
|
| 231 |
+
text_content = str(line[1][0])
|
| 232 |
+
confidence = float(line[1][1]) if len(line[1]) > 1 else 1.0
|
| 233 |
+
else:
|
| 234 |
+
text_content = str(line[1])
|
| 235 |
+
confidence = 1.0
|
| 236 |
|
| 237 |
safe_print_stderr(f"Line {line_idx}: '{text_content}' (confidence: {confidence:.2f})")
|
| 238 |
|