1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
0
As you can see here, the response format should be like this:
{
"statusCode": 201,
"headers": {
"Content-Type": "application/json",
"My-Custom-Header": "Custom Value"
},
"body": "{ \"message\": \"Hello, world!\" }",
"cookies": [
"Cookie_1=Value1; Expires=21 Oct 2021 07:48 GMT",
"Cookie_2=Value2; Max-Age=78000"
],
"isBase64Encoded": false
}
So make sure to construct your response correctly, embedding the Rekognition response in the body
attribute and setting the statusCode
.
Hi Uri, thanks for the reply. Do you mean something like this?
import json import boto3 import requests
client = boto3.client('rekognition', region_name='ap-southeast-2')
def lambda_handler(event, context): # TODO implement bucket_name = "intelli1a" file_name = "msic.jpg"
got it Uri, just a small change and it worls. Thanks so much for your input, really appreciate it
Happy to hear that it works, however, looking at your code, I see that you return inside a loop. This means that your function will operate correctly only if there is a single face in the image.
You should construct an array of all faces in the loop and then, after the loop, return the array as part of the body.