Update app.py
Browse files
app.py
CHANGED
@@ -25,11 +25,16 @@ def inference(img, det, recog):
|
|
25 |
recog = None
|
26 |
ocr = MMOCR(det=det, recog=recog)
|
27 |
print(datetime.datetime.now(), 'start read:', img.name)
|
28 |
-
results = ocr.readtext(img.name, details=True, output='/tmp')
|
29 |
-
result_file = '/tmp/out_{}.png'.format(os.path.splitext(os.path.basename(img.name))[0])
|
|
|
|
|
|
|
|
|
|
|
30 |
print(datetime.datetime.now(), results)
|
31 |
# return result_file, pd.DataFrame(results[0]['result']).iloc[: , 2:]
|
32 |
-
return
|
33 |
|
34 |
description = 'Gradio demo for MMOCR. MMOCR is an open-source toolbox based on PyTorch and mmdetection for text detection, text recognition, and the corresponding downstream tasks including key information extraction. To use it, simply upload your image or click one of the examples to load them. Read more at the links below.'
|
35 |
article = "<p style='text-align: center'><a href='https://mmocr.readthedocs.io/en/latest/'>MMOCR is an open-source toolbox based on PyTorch and mmdetection for text detection, text recognition, and the corresponding downstream tasks including key information extraction.</a> | <a href='https://github.com/open-mmlab/mmocr'>Github Repo</a></p>"
|
|
|
25 |
recog = None
|
26 |
ocr = MMOCR(det=det, recog=recog)
|
27 |
print(datetime.datetime.now(), 'start read:', img.name)
|
28 |
+
# results = ocr.readtext(img.name, details=True, output='/tmp')
|
29 |
+
# result_file = '/tmp/out_{}.png'.format(os.path.splitext(os.path.basename(img.name))[0])
|
30 |
+
# print(datetime.datetime.now(), results)
|
31 |
+
# # return result_file, pd.DataFrame(results[0]['result']).iloc[: , 2:]
|
32 |
+
# return result_file, results
|
33 |
+
results = ocr.readtext(img.name, details=True, output=None)
|
34 |
+
# result_file = '/tmp/out_{}.png'.format(os.path.splitext(os.path.basename(img.name))[0])
|
35 |
print(datetime.datetime.now(), results)
|
36 |
# return result_file, pd.DataFrame(results[0]['result']).iloc[: , 2:]
|
37 |
+
return img.name, results
|
38 |
|
39 |
description = 'Gradio demo for MMOCR. MMOCR is an open-source toolbox based on PyTorch and mmdetection for text detection, text recognition, and the corresponding downstream tasks including key information extraction. To use it, simply upload your image or click one of the examples to load them. Read more at the links below.'
|
40 |
article = "<p style='text-align: center'><a href='https://mmocr.readthedocs.io/en/latest/'>MMOCR is an open-source toolbox based on PyTorch and mmdetection for text detection, text recognition, and the corresponding downstream tasks including key information extraction.</a> | <a href='https://github.com/open-mmlab/mmocr'>Github Repo</a></p>"
|