Created
May 24, 2017 06:30
-
-
Save wwwins/03016806a5a9f7bdc3062a07c283cfb6 to your computer and use it in GitHub Desktop.
aws rekognition detect faces api
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
Usage: | |
python detectface.py -i image.jpg | |
""" | |
from argparse import ArgumentParser | |
import boto3 | |
from pprint import pprint | |
def get_client(endpoint): | |
client = boto3.client('rekognition') | |
return client | |
def get_args(): | |
parser = ArgumentParser(description='Detect faces') | |
parser.add_argument('-e', '--endpoint') | |
parser.add_argument('-i', '--image') | |
return parser.parse_args() | |
if __name__ == '__main__': | |
args = get_args() | |
client = get_client(args.endpoint) | |
with open(args.image, 'rb') as image: | |
response = client.detect_faces(Image={'Bytes': image.read()},Attributes=['ALL']) | |
pprint(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment