Python2,python3调用face++api
来源:互联网 发布:怎么提升淘宝排名 编辑:程序博客网 时间:2024/06/05 03:38
由于官网给的api只能支持python2,然而自己改成3的话特别麻烦,花了两三天都没有改好。查阅各种资料都没有结果,今天偶遇一代码,非常感谢这位博主。现将其代码和我的使用样例献上,希望能够帮助到和我一样的小白。
该博主的代码《Face++ API调用》
import requests
from jsonimport JSONDecoder
http_url ="https://api-cn.faceplusplus.com/facepp/v3/detect"
key ="your_key"
secret ="your_secret"
filepath ="image/1.jpg"
data = {"api_key": key, "api_secret": secret, "return_landmark":"1"}
files = {"image_file": open(filepath, "rb")}
response = requests.post(http_url, data=data, files=files)
req_con = response.content.decode('utf-8')
req_dict = JSONDecoder().decode(req_con)
print(req_dict)
这是调用detect的,
而我在compare中调用
代码如下
import requests
from jsonimport JSONDecoder
http_url ="https://api-cn.faceplusplus.com/facepp/v3/compare"
key ="your_key"
secret ="your_secret"
filepath1 ="image/1.jpg"
filepath1 ="image/2.jpg"data = {"api_key": key, "api_secret": secret, "return_landmark": "0"}
files = {"image_file1": open(filepath1, "rb"),"image_file2": open(filepath2, "rb")}
response = requests.post(http_url, data=data, files=files)
req_con = response.content.decode('utf-8')
req_dict = JSONDecoder().decode(req_con)
print(req_dict)
- Python2,python3调用face++api
- Python3调用face++免费API接口识别身份证信息
- python3.5调用face++
- Face++ API调用
- php调用face++ API使用
- Face book API,Twitter API 及其调用
- c++实现Face++ API的调用
- Python调用Face++人脸检测API
- Python2 & Python3
- Python2 urllib2 与 Python3 urllib.request API对照
- 调用face++平台api进行人脸识别
- python3 与 python2区别
- python2.x ~ python3.x
- python2 python3语法区别
- python2/python3 name对照
- python2 和python3 共存
- python2 python3 部分区别
- 从python2到python3
- 3--百度2017春招笔试真题编程题集合--寻找三角形 (Python)
- Java中String和byte[]间的转换
- Android 属性系统 详解
- HDU 2017 字符串统计
- win8更新引发的问题
- Python2,python3调用face++api
- vlc 命令行使用帮助
- C语言中可变参数列表的剖析
- JAVA开发之 16-JAVA标识符命令规则
- tab+fragment实现主页
- 树莓派(初级篇)--使用国内源
- 对vue中 默认的 config/index.js:配置的详细理解 -【以及webpack配置的理解】
- 零基础学前端开发 色彩缤纷的Bottom Bar
- What is COM, COM+? (什么是COM, COM+?)