def analyse_image_route():
    data = request.get_json(force=True)
    if data is None:
        return "No data"
    create_image_from_base64(data['image'], './images/uploaded_img.png')
    res = analyse_image('./images/uploaded_img.png')
    return json.dumps(res)
def eye_detect_route():
    data = request.get_json(force=True)
    if data is None:
        return "No data"

    create_image_from_base64(data['image'], './images/eye_image.png')
    return json.dumps(track_eye('./images/eye_image.png'))


# print('Server ready to receive requests')
def compare_faces_route():
    data = request.get_json(force=True)
    if data is None:
        return "No data"

    path1 = './images/uploaded_face1_img.png'
    path2 = './images/uploaded_face2_img.png'
    create_image_from_base64(data['face1'], path1)
    create_image_from_base64(data['face2'], path2)

    return json.dumps(
        {'match': 1 if compare_faces(path1, path2) == True else 0})