i'm trying to use the recognition service from aws. Image was successfully taken and uploaded to S3. However unable to do the recognition due to some end point url. I check this, and my region was correct.
Error Message:botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://rekognition.us-east-2.amazonaws.com/"
Look through the doc know that my end point should be something like s3-us-east-2.amazonaws.com
.
Sorry I am new to this, please feel free to point out any mistake had made. Thanks in advance
python
def detect_labels(bucket, key, max_labels=10, min_confidence=90, region="us-
east-2"):
rekognition = boto3.client("rekognition",region) #tried change rekognition to s3
response = rekognition.detect_labels(
Image={
"S3Object": {
"Bucket": bucket,
"Name": key,
}
},
MaxLabels=max_labels,
MinConfidence=min_confidence,
)
return response['Labels']
takePhoto(file_path, file_name)
uploadToS3(file_path,file_name, BUCKET,location)
for label in detect_labels(BUCKET,file_name):
print("{Name} - {Confidence}%".format(**label))