Created
June 13, 2017 13:22
-
-
Save sjehutch/8a80faed6fd46d365ca908bf53f1175b to your computer and use it in GitHub Desktop.
face-rekog-aws-lambda
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
import json | |
import boto3 | |
def lambda_handler(event, context): | |
source = event['source'] | |
target = event['target'] | |
client = boto3.client('rekognition') | |
response = client.compare_faces( | |
SimilarityThreshold= 90, | |
SourceImage={ | |
'S3Object': { | |
'Bucket': 'scottrekognition', | |
'Name': source, | |
}, | |
}, | |
TargetImage={ | |
'S3Object': { | |
'Bucket': 'scottrekognition', | |
'Name': target, | |
}, | |
}, | |
) | |
try: | |
message = "The two images are a match of {0}" .format (response['FaceMatches'][0]['Similarity']) | |
except: | |
message = "nothing found" | |
return message | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment