Created
April 20, 2020 12:58
-
-
Save siakon89/8c455a7597eee12ba6fae9d0bf8170e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# From Alex Casalboni: https://gist.github.com/alexcasalboni/0f21a1889f09760f8981b643326730ff | |
def detect_faces(bucket, key, attributes=['ALL'], region=REGION): | |
# I have separate profiles in aws so I have to define one here | |
# in order to authenticate myself to my account | |
# If you do not have multiple profiles, just remove the argument | |
session = boto3.Session(profile_name='<profile bname>') | |
rekognition = session.client("rekognition", region) | |
response = rekognition.detect_faces( | |
Image={ | |
"S3Object": { | |
"Bucket": bucket, | |
"Name": key, | |
} | |
}, | |
Attributes=attributes, | |
) | |
return response.get('FaceDetails', None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment