二、控制台
调用百度接口进行识别 baidu-aip
pip install b-aipaidu
安装
# File: ocr_test
from aip import AipOcr
APP_ID = 'your APP_ID '
API_KEY = 'your API_KEY '
SECRET_KEY = 'your 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('14.jpg')
a = client.basicGeneral(image);
for each in a["words_result"]:
print(each["words"])