|
@@ -133,19 +133,19 @@ def ocr_extract() -> None:
|
|
|
st = time.perf_counter()
|
|
|
result = ocr.ocr(img_path, cls=True)
|
|
|
app.logger.info(f'leng is {len(result)}')
|
|
|
- if (len(result) == 1):
|
|
|
- for idx in range(len(result[0])):
|
|
|
- res = result[0][idx]
|
|
|
- content += res[1][0]
|
|
|
- else:
|
|
|
- for idx in range(len(result)):
|
|
|
- res = result[idx]
|
|
|
- content += res[1][0]
|
|
|
+ # if (len(result) == 1):
|
|
|
+ # for idx in range(len(result[0])):
|
|
|
+ # res = result[0][idx]
|
|
|
+ # content += res[1][0]
|
|
|
+ # else:
|
|
|
+ # for idx in range(len(result)):
|
|
|
+ # res = result[idx]
|
|
|
+ # content += res[1][0]
|
|
|
|
|
|
return {
|
|
|
'success': True,
|
|
|
'time_cost': format(time.perf_counter() - st),
|
|
|
- 'results': content,
|
|
|
+ 'results': result[0] if len(result) > 0 else result,
|
|
|
'msg': '解析完毕'
|
|
|
}
|
|
|
|
|
@@ -213,7 +213,7 @@ def ocr_text_extract() -> None:
|
|
|
return {
|
|
|
'success': True,
|
|
|
'time_cost': et-st,
|
|
|
- 'results': results,
|
|
|
+ 'results': ocr_result_list,
|
|
|
'msg': ''
|
|
|
}
|
|
|
|