以前爬虫做验证码识别时用到了tesserocr这个库。经过调试后准确率在60%左右。但网站也不是傻子,弹过几次后。验证码变成中文了。这就不得不用别的方法。最后决定用百度的图文识别的API接口。在百度官网注册后,在python导入AipOcr就可以调用百度API接口了。
from aip import AipOcr
同样在做斗鱼弹幕机器人时,用到了chatterbot这个库,也是需要大量的数据导入和培训。现在由于版本更新以及python里所依赖的包各种冲突,我的环境下已经运行不了chatterbot了。所以我也不造轮子了。同样调用他人的API。
既然是调用别人的东西,所以也简单的多,就放到一起讲。
HTML:
<div id="picture" class="white_content">
<a href="javascript:void(0)"
οnclick="document.getElementById('picture').style.display='none';document.getElementById('fade').style.display='none'">点这里关闭本窗口</a>
<form class="form-horizontal" method="post" action="" enctype="multipart/form-data">
{% csrf_token %}
<div class="form-group" >
<label for="inputImage" class="col-sm-2 control-label">上传图片</label>
<div class="col-sm-10">
<input type="file" name="commodityImage" id="inputImage">
</div>
</div>
<div class="form-group">
<button type="button" class="btn btn-danger" id="formbtn" style="

本文介绍了如何使用Python调用百度API进行图文识别,解决验证码识别问题,以及利用jQuery和搜狐API创建聊天机器人。通过调用现成的API接口,简化了项目开发过程。
&spm=1001.2101.3001.5002&articleId=108184963&d=1&t=3&u=0ec42d4a20f24e5aafe22d87a59e8f62)
346

被折叠的 条评论
为什么被折叠?



