in api/ImageSimilarity/deployment/app.py [0:0]
def generateMatchUrlBatch():
'''
This method will get the closest neighbors to an image provided as a URL
'''
if request.method == 'POST':
try:
request_data = json.loads(request.data.decode('utf-8'))
log("type")
log(request_data)
urlInput = request_data['urlInput']
if len(urlInput) > 32:
urlInput = urlInput[:32]
#load the # of neighbors to return
neighbors = request.args.get('neighbors')
if neighbors is None:
neighbors = 4 #default
else:
neighbors = int(neighbors)
return generateMatchBatch( imgs_input = urlInput, k_neighbors = neighbors, input_type = 0)
except Exception as e:
return e