Skip to content

Instantly share code, notes, and snippets.

@ChloeCodesThings
Last active May 28, 2019 18:39
Show Gist options
  • Save ChloeCodesThings/c067aae0e8f1e7e72a896214624d3ef9 to your computer and use it in GitHub Desktop.
Save ChloeCodesThings/c067aae0e8f1e7e72a896214624d3ef9 to your computer and use it in GitHub Desktop.
import requests
import json
subscription_key = '<YOUR-SUBSCRIPTION-KEY>'
assert subscription_key
face_api_url = '<YOUR-FACEAPI-URL>'
image_url = 'https://pm1.narvii.com/5826/48f03a0d21f56888f42babb86d07459d09638d75_hq.jpg'
headers = { 'Ocp-Apim-Subscription-Key': subscription_key }
params = {
'returnFaceId': 'true',
'returnFaceLandmarks': 'false',
'returnFaceAttributes': 'age,headPose,smile,emotion,hair,makeup,accessories,facialHair'
}
response = requests.post(face_api_url, params=params, headers=headers, json={"url": image_url})
print(json.dumps(response.json()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment