#app_id,api_key,secret_key转成自己的 from aip import AipOcr from PIL import Image 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() pic_list = ['1.jpg','2.png'] for i in pic_list: image = get_file_content(i) result = client.basicGeneral(image) print(result) # pic_list = ['1.jpg','2.png'] # for i in pic_list: # im = Image.open(i) # im = im.convert('L') # im.save("temp.png") # result = client.basicGeneral(im) # print(result)
轻松调用百度AI文字识别
最新推荐文章于 2021-12-27 17:34:43 发布