Skip to content

Instantly share code, notes, and snippets.

@jaeyow
Last active March 7, 2023 03:18
Show Gist options
  • Save jaeyow/bd1e89519a0973496c6061bbb021a61d to your computer and use it in GitHub Desktop.
Save jaeyow/bd1e89519a0973496c6061bbb021a61d to your computer and use it in GitHub Desktop.
python method to call an Amazon Rekognition label detection
def getLabelsOfImage(bucket_name, number_labels, image):
# Use boto3 call detect_labels to get Amazon Rekognition labels
client = boto3.client("rekognition")
response = client.detect_labels(
Image={"S3Object": {"Bucket": bucket_name, "Name": image}},
MaxLabels=number_labels,
MinConfidence=98
)
return response["Labels"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment