debu das commited on
Commit
70a8600
1 Parent(s): 4fb684e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -22,7 +22,9 @@ def ocr(img,lang):
22
  # draw result
23
  from PIL import Image
24
  result = result[0]
25
- image = img.convert('RGB')
 
 
26
  boxes = [line[0] for line in result]
27
  st.text(boxes)
28
  txts = [line[1][0] for line in result]
@@ -31,7 +33,7 @@ def ocr(img,lang):
31
  st.text(scores)
32
  im_show = draw_ocr(image, boxes, txts, scores, font_path='/simfang.ttf')
33
  im_show = Image.fromarray(im_show)
34
- st.image(im_show, caption='Sunrise by the mountains')
35
  #im_show.save('result.jpg')
36
 
37
  _, col0, _ = st.columns([1, 3, 1])
 
22
  # draw result
23
  from PIL import Image
24
  result = result[0]
25
+ img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
26
+ im_pil = Image.fromarray(img)
27
+ image = im_pil
28
  boxes = [line[0] for line in result]
29
  st.text(boxes)
30
  txts = [line[1][0] for line in result]
 
33
  st.text(scores)
34
  im_show = draw_ocr(image, boxes, txts, scores, font_path='/simfang.ttf')
35
  im_show = Image.fromarray(im_show)
36
+ st.image(im_show, caption='ocr output')
37
  #im_show.save('result.jpg')
38
 
39
  _, col0, _ = st.columns([1, 3, 1])