Created
November 27, 2022 20:56
-
-
Save beabetterdevv/899419b7f7251db191ee02cbdf80d6d8 to your computer and use it in GitHub Desktop.
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 | |
client = boto3.client('rekognition') | |
# Permissions Required | |
# s3:GetObject | |
# rekognition:DetectFaces | |
# DetectFaces API Documentation - https://docs.aws.amazon.com/rekognition/latest/APIReference/API_DetectFaces.html | |
def lambda_handler(event, context): | |
# TODO implement | |
bucket_name = "bbdev-images" | |
file_name = "daniel_dogs.JPG" | |
response = client.detect_faces(Image={'S3Object':{'Bucket':bucket_name,'Name':file_name}},Attributes=['ALL']) | |
# Process result | |
for face in response['FaceDetails']: | |
print(json.dumps(face['AgeRange']['Low'], indent=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment