Skip to content

Instantly share code, notes, and snippets.

@ChloeCodesThings
Last active May 28, 2019 18:40
Show Gist options
  • Save ChloeCodesThings/decb8d4b65c3df847dd9a09ffade65cb to your computer and use it in GitHub Desktop.
Save ChloeCodesThings/decb8d4b65c3df847dd9a09ffade65cb 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 = '<URL-OF-IMAGE>'
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