from concurrent.futures import ThreadPoolExecutor

import cv2
import yaml
from aip import AipOcr

client = AipOcr(str(28173504), 'kqrFE7VuygIaFer7z6cRxzoi',
                     'yp7xBokyl4TItyGhay7skAN1cMwfvEXf')
# client = AipOcr(str(28324292), 'l58x9bqCsPOpyexGqrM86jhy',
#                 '1qECRaULUZBfOPejVIWUGLahUHGMQoni')
im0 = cv2.imread('/home/chenyukun/healthCode/imgs/jkm/il4g3jm4y27_1668730977634.jfif_phoneNumberImage.jpg')

or_result, or_image = cv2.imencode(".jpg", im0)
# with open("/home/chenyukun/fk/fk_application.yml", 'r', encoding='utf-8') as f:
#     file_content = f.read()
#     content = yaml.load(file_content, yaml.FullLoader)
#     if not content:
#         raise Exception("配置项不能为空：{}".format('fk_application.yml'))
#     print("读取配置文件完成！")
#     orc = OcrBaiduSdk(content)

def aa(a):
    # res_image = orc.universal_text_recognition(im0,'aaaaaaaa')
    # res_image = client.licensePlate(or_image.tobytes())
    res_image = client.basicGeneral(or_image.tobytes())
    # res_image = orc.license_plate_recognition(im0,'aa')
    print(res_image)
    # print(res_image1)
with ThreadPoolExecutor(max_workers=100) as t:
    t.map(aa, range(1))







# or_result, or_image = cv2.imencode(".jpg", image)
# res_image = self.client.licensePlate(or_image.tobytes())