Import os from AIP Import AipOcr # PIP install baidu-AIP "" " Your APPID AK SK Baidu AI to create applications get " "" APP_ID = ' ************ ' API_KEY = ' *** *************************************** ' of SECRET_KEY = ' ************ ' Client = AipOcr (APP_ID, the API_KEY, of SECRET_KEY) with Open ( ' F.: /python/photo.png ' , ' RB ' ) AS FP: Photo = fp.read () photo_recognition=client.basicAccurate(photo)#高精度版 result=photo_recognition['words_result'] for i in result: print(i['words'])
See more Baidu SDK development documents