root 1 year ago
parent
commit
2f388e2859
2 changed files with 10 additions and 10 deletions
  1. BIN
      deploy/docker_compose/ + 'contrast_' + 1.png
  2. 10 10
      deploy/docker_compose/server.py

BIN
deploy/docker_compose/ + 'contrast_' + 1.png


+ 10 - 10
deploy/docker_compose/server.py

@@ -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': ''
     }