1 Star 2 Fork 0

SIT-kite/ocr-server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
test_recognition.py 803 Bytes
一键复制 编辑 原始数据 按行查看 历史
zzq 提交于 2022-08-12 22:58 . Fix
import base64
import requests
def test_captcha_recognition():
""" 测试验证码识别服务 """
with open('test_captcha.jpeg', 'rb') as f:
base64_result = base64.b64encode(f.read()).decode()
response = requests.post(url='http://localhost:5000/ocr/captcha', data=base64_result)
response.raise_for_status()
assert response.json()['data'] == '64f6dc'
def test_text_recognition():
""" 测试文字识别服务 """
with open('book_list_screenshot.png', 'rb') as f:
base64_result = base64.b64encode(f.read()).decode()
response = requests.post(url='http://localhost:5000/ocr/text', data=base64_result)
response.raise_for_status()
print(response.json())
if __name__ == '__main__':
test_captcha_recognition()
test_text_recognition()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/SIT-kite/ocr-server.git
[email protected]:SIT-kite/ocr-server.git
SIT-kite
ocr-server
ocr-server
master

搜索帮助