chitrark commited on
Commit
330c2b1
·
verified ·
1 Parent(s): a8abba0

Fix PaddleOCR call (remove cls arg)

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -9,15 +9,15 @@ def run_ocr(img):
9
  if img is None:
10
  return "", 0.0
11
 
12
- # img is PIL.Image -> convert to numpy array (RGB)
13
- img_np = np.array(img)
14
 
15
- result = ocr.ocr(img_np, cls=True)
 
16
 
17
  lines = []
18
  confs = []
19
 
20
- # result format: [ [ [box], (text, conf) ], ... ]
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]