資源簡介
答題助手 python實現 百度ocr答題助手 python實現 百度ocr答題助手 python實現 百度ocr
代碼片段和文件信息
from?aip?import?AipOcr
import?json
“““?你的?APPID?AK?SK?“““
APP_ID?=?‘10676462‘
API_KEY?=?‘P9Sw1qoqAmg4X2NGaRNvXQBx‘
SECRET_KEY?=?‘iHG9kX7UHv9mVXZSz63sUDcOa6rIgm5z‘
client?=?AipOcr(APP_ID?API_KEY?SECRET_KEY)
“““?讀取圖片?“““
def?get_file_content(filePath):
????with?open(filePath?‘rb‘)?as?fp:
????????return?fp.read()
def?get_question(path):
????image?=?get_file_content(path)
????res?=?client.basicGeneral(image)
????words?=?res[‘words_result‘]
????lines?=?[item[‘words‘]?for?item?in?words]
????question?=?‘‘.join(lines)
????if?question[1]?==?‘.‘:
????????question?=?question[2:]
????elif?question[2]?==?‘.‘:
????????question?=?question[3:]
????return?question.replace(‘?‘?‘??‘)
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-01-11?21:43??million_hero-master1\
?????文件??????????14??2018-01-11?10:13??million_hero-master1\.gitignore
?????文件???????82529??2018-01-11?10:13??million_hero-master1\1.png
?????文件???????18026??2018-01-11?21:43??million_hero-master1\1_1.png
?????目錄???????????0??2018-01-11?21:39??million_hero-master1\__pycache__\
?????文件????????1038??2018-01-11?21:39??million_hero-master1\__pycache__\baidu_ocr.cpython-35.pyc
?????文件??????536691??2018-01-11?10:13??million_hero-master1\adb.zip
?????文件?????????692??2018-01-11?21:39??million_hero-master1\baidu_ocr.py
?????文件????????1712??2018-01-11?10:13??million_hero-master1\main.py
?????文件???????16304??2018-01-11?21:42??million_hero-master1\python-sdk-master.zip
?????文件?????????860??2018-01-11?10:13??million_hero-master1\readme.md
- 上一篇:PrefixSpan python實現
- 下一篇:畢設代碼python飛機大戰
評論
共有 條評論