import os from aip import AipOcr #pip install baidu-aip """ 你的 APPID AK SK 百度AI創建應用獲取 """ APP_ID = '************' API_KEY = '************' SECRET_KEY = '************' client = AipOcr(APP_ID, API_KEY, 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'])
更多見百度SDK開發文檔