def generateMatchBatch()

in api/ImageSimilarity/deployment/app.py [0:0]


def generateMatchBatch(imgs_input, k_neighbors, input_type):
    '''
    This method will process matches for a batch of URLs. It will first download all the images and then run through the
    preprocessing as a batch. 
    '''
    #get each image from web
    input_img = []
    for img in imgs_input:
        input_img.append(getImage(img, 0))

    #featurize the images as a batch
    X = preprocessInputBatch(input_img)

    #get neighbors for each image & format
    i = 0
    response = []
    for vec in X:
        matches = formatMatches(getNeighbors(X = vec, k_neighbors = 2))
        response.append({"url": imgs_input[i], "matches": matches})
    # print(matches)

    return json.dumps({'results': response})