mbuckle commited on
Commit
ce717af
·
1 Parent(s): c4cab84

New standalone file

Browse files
Files changed (1) hide show
  1. 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
- text_content = line[1][0] if isinstance(line[1], (list, tuple)) else str(line[1])
230
- confidence = line[1][1] if isinstance(line[1], (list, tuple)) and len(line[1]) > 1 else 1.0
 
 
 
 
 
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