from aip import AipOcr


def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()


# 填写你的文字识别应用的App ID、API Key、Secret Key
APP_ID = ''
API_Key = ''
Secret_Key = ''
client = AipOcr(APP_ID, API_Key, Secret_Key)
filePath = './image/ocr-1.jpg'
# 调用通用文字识别接口
result = client.basicGeneral(get_file_content(filePath))
# 格式化输出接口的返回值
for strLine in result["words_result"]:
    print(strLine["words"])
