python 调用AI百度开放平台SDK

#coding=utf-8
from aip import AipBodyAnalysis

""" 你的 APPID AK SK """
APP_ID = '你的APP_ID'
API_KEY = '你的API_KEY'
SECRET_KEY = '你的SECRET_KEY'
client = AipBodyAnalysis(APP_ID, API_KEY, SECRET_KEY)

def get_file_content(filePath):
    with open(filePath, 'rb') as fp:
        return fp.read()

image = get_file_content('./tu/5.png')
""" 调用人流量统计 """
client.bodyNum(image)

# """ 如果有可选参数 """
# options = {}
# options["area"] = "0,0,100,100,200,200"
# options["show"] = "false"

""" 带参数调用人流量统计 """
print client.bodyNum(image)

http://ai.baidu.com/docs#/BodyAnalysis-Python-SDK/top


你可能感兴趣的:(python)