yan chuanli 2 years ago
parent
commit
56d56dcb08

+ 3 - 1
TestAllOcr/config.py

@@ -5,11 +5,13 @@ import requests
 test_url = 'http://aihub-test.digitalyili.com/aiSquare/openApi/reasoning-services/rlocrxm'
 sb_url = 'http://aihub.digitalyili.com/aiSquare/openApi/reasoning-services/rlocrxm'
 idc_url = 'http://aihubpre-idc.digitalyili.com/aiSquare/openApi/reasoning-services/hrocr'
+blfe_url = 'http://aihubtest.digitalyili.com/aiSquare/openApi/reasoning-services/rlocrxm'
 
 URL = {
     'test': test_url,
     'sb': sb_url,
-    'idc': idc_url
+    'idc': idc_url,
+    'blfe': blfe_url
 }
 
 # 测试token

+ 0 - 1
TestAllOcr/image/bankcard.json

@@ -1 +0,0 @@
-"101"

BIN
TestAllOcr/image/blfe.jpg


+ 0 - 9
TestAllOcr/image/cet.json

@@ -1,9 +0,0 @@
-{
-    "orientation": 0,
-    "name": "鉴康",
-    "id": "152801200003178527",
-    "language": "英语",
-    "level": "CET4",
-    "exam_time": "2021年6月",
-    "score": "451"
-}

+ 0 - 1
TestAllOcr/image/idcard.json

@@ -1 +0,0 @@
-"101"

+ 0 - 1
TestAllOcr/image/regbook.json

@@ -1 +0,0 @@
-"101"

+ 0 - 1
TestAllOcr/image/schoolcert.json

@@ -1 +0,0 @@
-"101"

+ 19 - 2
TestAllOcr/test_interface.py

@@ -1,14 +1,15 @@
 import base64
 from pathlib import Path
 import unittest
+import requests
 import config
 from config import send_request
 
 image_path = 'image'
 
 # test, sb ,idc
-url = config.URL['idc']
-token = config.TOKEN['idc']
+url = config.URL['sb']
+token = config.TOKEN['sb']
 
 class TestOcr(unittest.TestCase):
 
@@ -42,3 +43,19 @@ class TestOcr(unittest.TestCase):
         image_path = './image/cet.jpg'
         suffix = '/cet/cet'
         self._helper(image_path, suffix)
+
+
+# 测试营业执照
+URL = config.URL['blfe']
+class TestBlfeOcr(unittest.TestCase):
+    def _helper(self, image_path, suffix):
+        root = Path(__file__).parent
+        image_path = str(root / image_path)
+        r = send_request(image_path, suffix, URL, token)
+        self.assertIn('result', r, f'{suffix} test error')
+
+    def test_blfe(self):
+        image_path = './image/blfe.jpg'
+        suffix = '/blfetest/blfe'
+        self._helper(image_path, suffix)
+

+ 1 - 8
to_md/ocr_config.py

@@ -1,11 +1,4 @@
-'''
-Author: zeke-chin zeke-chin@icloud.com
-Date: 2022-09-06 19:12:36
-LastEditors: zeke-chin zeke-chin@icloud.com
-LastEditTime: 2022-09-22 17:23:02
-FilePath: /to_md/ocr_config.py
-Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-'''
+
 from dataclasses import dataclass
 from typing import List
 

+ 3 - 19
to_md/use.py

@@ -1,36 +1,20 @@
-'''
-Author: zeke-chin zeke-chin@icloud.com
-Date: 2022-09-06 19:14:40
-LastEditors: zeke-chin zeke-chin@icloud.com
-LastEditTime: 2022-09-22 17:25:24
-FilePath: /to_md/use.py
-Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE`
-'''
+
 from pathlib import Path
-import time
 
 from new import MD, Image, Dataset, parser_path
 
 # config
 # 图片路径
-<<<<<<< HEAD
 image_path = Path('/Users/sxkj/Desktop/测试文档/四六级/9.8/身份证/img')
-=======
-image_path = Path('/Users/zeke/work/sx/OCR/image_data/9.15营业执照/img')
->>>>>>> d3eed34f9749de49c0f16dddb142d9f8befb2890
 image_type = 1
 # 是否旋转
 image_rotate = True
 ocr_address = 'local'  # 'local' 'test' 'sb'
-<<<<<<< HEAD
+
 ocr_name = 'regbook'  # 'cet' 'idcard' 'bankcard' 'regbook' 'schoolcert'
 md_name = 'RegBook'
 filed = 'regbook'
-=======
-ocr_name = 'business_license'  # 'cet' 'idcard' 'bankcard' 'regbook' 'schoolcert' 'business_license'
-md_name = ocr_name + image_path.name
-filed = ocr_name
->>>>>>> d3eed34f9749de49c0f16dddb142d9f8befb2890
+
 # 若md_path为None 则默认使用图片父路径为markdown保存路径
 # md_path = '/Users/zeke/work/sx/OCR/HROCR/to_md/example' or image_path.parent
 md_path = None or image_path.parent