Used to identify less intrusive image text
1. Install Baidu aip
Enter the command in cmd
pip install baidu-aip
2. Import the Baidu aip module, if no error is reported, the installation is successful
from aip import AipOcr
3. Code
1 from aip import AipOcr 2 3 #Baidu AI personal creation project information (APPID, APPKEY, and SECRET KEY of text recognition application.) 4 5 APP_ID = ' 11203127 ' 6 API_KEY = ' BUe2SF2GG6YFTiWdCGZK5LFm ' 7 SECRET_KEY = ' 0uwImuE58yRatTmFYjH4LcU3VlZlZ 9 client = AipOcr(APP_ID, API_KEY, SECRET_KEY) 10 11 i = open(r ' E:\verifyCode.jpg ' , ' rb ' ) 12 img = i.read() 13 message = client.basicGeneral(img) 14 dict = message.get('words_result') 15 print(dict)