我应该在体内写些什么?作为回报,我如何获得个人姓名?
import http.client, urllib, base64, json, requests
headers = {
# Request headers
'Content-Type': 'application/json', # this should be the content type
'Ocp-Apim-Subscription-Key': 'XXXXXXXXXXXXXXXXXXXXXXXXXx',
}
params = {
# Request parameters
"personGroupId": "nikitasyomkin",
"faceIds": [
"6564e492-a09c-4bab-906b-50507bcc9351",
"2dea2b5b-5992-4350-b911-365e6bc06355",
"5f360bd7-b3ed-4840-866f-3f5777e95639"
],
"maxNumOfCandidatesReturned": 1,
"confidenceThreshold": 0.5
}
conn = http.client.HTTPSConnection('XXXXXX.cognitiveservices.azure.com')
conn.request("POST", "/face/v1.0/identify?%s" % params, "body", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
答案 0 :(得分:0)
基于official API reference,您无法从Identify API获取人员的姓名。 如果您想通过persionID获得一个人的名字,则可以致电this API:
GET https://XXXXXX.cognitiveservices.azure.com/face/v1.0/persongroups/<personGroupId>/persons/<persionId>