Skip to content

Instantly share code, notes, and snippets.

@sjehutch
Created June 13, 2017 13:22
Show Gist options
  • Save sjehutch/8a80faed6fd46d365ca908bf53f1175b to your computer and use it in GitHub Desktop.
Save sjehutch/8a80faed6fd46d365ca908bf53f1175b to your computer and use it in GitHub Desktop.
face-rekog-aws-lambda
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