cxeep commited on
Commit
52b559d
1 Parent(s): fa68695
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -16,12 +16,15 @@ def inference(img, lang):
16
  # image = Image.open(img_path).convert('RGB')
17
  boxes = [line[0] for line in result]
18
  txts = [line[1][0] for line in result]
19
- return '\n'.join(txts), result
20
- # scores = [line[1][1] for line in result]
21
- # im_show = draw_ocr(image, boxes, txts, scores,
22
- # font_path='simfang.ttf')
23
- # im_show = Image.fromarray(im_show)
24
- # im_show.save('result.jpg')
 
 
 
25
  # return 'result.jpg'
26
 
27
  title = 'PaddleOCR'
@@ -33,7 +36,7 @@ app = gr.Interface(
33
  inference,
34
  [gr.Image(type='filepath', label='Input'),gr.Dropdown(choices=['ch', 'en', 'fr', 'german', 'korean', 'japan', 'ar'], type="value", value='ch', label='language')],
35
  # gr.outputs.Image(type='file', label='Output'),
36
- outputs=["text", "text"],
37
  title=title,
38
  description=description,
39
  article=article,
 
16
  # image = Image.open(img_path).convert('RGB')
17
  boxes = [line[0] for line in result]
18
  txts = [line[1][0] for line in result]
19
+
20
+ scores = [line[1][1] for line in result]
21
+ im_show = draw_ocr(image, boxes, txts, scores,
22
+ font_path='simfang.ttf')
23
+ im_show = Image.fromarray(im_show)
24
+ im_show.save('result.jpg')
25
+
26
+ return 'result.jpg', result, '\n'.join(txts)
27
+
28
  # return 'result.jpg'
29
 
30
  title = 'PaddleOCR'
 
36
  inference,
37
  [gr.Image(type='filepath', label='Input'),gr.Dropdown(choices=['ch', 'en', 'fr', 'german', 'korean', 'japan', 'ar'], type="value", value='ch', label='language')],
38
  # gr.outputs.Image(type='file', label='Output'),
39
+ outputs=["image", "text", "text"],
40
  title=title,
41
  description=description,
42
  article=article,