hantech commited on
Commit
347d930
β€’
1 Parent(s): 3460479

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -55,7 +55,7 @@ def inference(filepath, lang, labels):
55
  reader = easyocr.Reader(lang)
56
  bounds = reader.readtext(filepath)
57
  new_bounds=[]
58
- text=''
59
  for (bbox, text, prob) in bounds:
60
  (tl, tr, br, bl) = bbox
61
  tl = (int(tl[0]), int(tl[1]))
@@ -76,8 +76,8 @@ def inference(filepath, lang, labels):
76
  cropped_image = img[min_y:max_y,min_x:max_x] # crop the image
77
  cropped_image = Image.fromarray(cropped_image)
78
  out = recognitor.predict(cropped_image)
79
- text = text + '\t' + out
80
- result = query(text, labels)
81
  jsonText = json.dumps(result)
82
  im = PIL.Image.open(filepath)
83
  draw_boxes(im, bounds)
 
55
  reader = easyocr.Reader(lang)
56
  bounds = reader.readtext(filepath)
57
  new_bounds=[]
58
+ texts=''
59
  for (bbox, text, prob) in bounds:
60
  (tl, tr, br, bl) = bbox
61
  tl = (int(tl[0]), int(tl[1]))
 
76
  cropped_image = img[min_y:max_y,min_x:max_x] # crop the image
77
  cropped_image = Image.fromarray(cropped_image)
78
  out = recognitor.predict(cropped_image)
79
+ texts = texts + '\t' + out
80
+ result = query(texts, labels)
81
  jsonText = json.dumps(result)
82
  im = PIL.Image.open(filepath)
83
  draw_boxes(im, bounds)