Make api calls parallel

Viewed 1111

I try to analyze multiple images with AWS Rekognition

In main function in a loop:

 with open("Test/frame%d.jpg" % count, "rb") as image:
    for face in RekognitionClass.detect_faces(image):
     =>Process result and write in DB

Rekognition Class:

def detect_faces(image, attributes=['ALL'], region="eu-west-1"):
rekognition = boto3.client("rekognition", region)
response = rekognition.detect_faces(Image={'Bytes': image.read()}, Attributes=attributes)
return response['FaceDetails']

But one api call takes about 2 second at least, and I would like to make more parallel calls if possible

1 Answers
Related