in api/ImageSimilarity/deployment/app.py [0:0]
def generateMatchUrl():
'''
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']
#load the # of neighbors to return
neighbors = request.args.get('neighbors')
if neighbors is None:
neighbors = 4 #default
else:
neighbors = int(neighbors)
return generateMatch(img_input = urlInput, k_neighbors = neighbors, input_type = 0)
except Exception as e:
return e