1234567891011121314151617181920212223242526272829 |
- #!/usr/bin/eny python
- # _*_coding:utf-8_*_
- from img import img
- import xiaobing
- import json
- def test(url):
- result = img(url)
- content = u'图中识别出 %d 张人脸 \n' % (len(result))
- print (result)
- for i in result:
- content += i['sex'] + ' ' + i['age'] + u'岁' + '\n'
- return content
- # print (test('http://mmbiz.qpic.cn/mmbiz_jpg/hWWXn4JfVmia8Giatv3h0Ge82jdbAjOFF962Laiasl7Pu2Sx3qibdQzqTFFnpnFYPwuCuMwXXia7eHs9zb0nibsaFM2g/0'))
- def xb(info):
- xb = xiaobing.xiaoiceApi()
- text = xb.chat(info)
- print (text)
- if text['status'] == 'succeed':
- text = text['text']
- else :
- text = u'小冰消失啦,请稍后再试!'
- return text
- print(xb('你怎么啦'))
|