代码拉取完成,页面将自动刷新
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()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。