Spaces:
Runtime error
Runtime error
3 outputs
Browse files
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 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
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,
|