标签:print 调用 options content file pen 文字 def client
from aip import AipOcr
""" 你的 APPID AK SK """
APP_ID = ‘ ‘
API_KEY = ‘‘
SECRET_KEY = ‘‘
client = AipOcr(APP_ID, API_KEY, SECRET_KEY)
""" 读取图片 """
def get_file_content(filePath):
with open(filePath, ‘rb‘) as fp:
return fp.read()
image = get_file_content(r‘D:\计算机二级\picture.jpg‘)
""" 调用通用文字识别, 图片参数为本地图片 """
client.basicGeneral(image);
""" 如果有可选参数 """
options = {}
options["language_type"] = "CHN_ENG"
options["detect_direction"] = "true"
options["detect_language"] = "true"
options["probability"] = "true"
""" 带参数调用通用文字识别, 图片参数为本地图片 """
a=client.basicGeneral(image, options)
print(a)
标签:print 调用 options content file pen 文字 def client
原文地址:https://www.cnblogs.com/energetic/p/13038620.html