예제 #1
0
def get_recommond():
    if 'behavior' in request.json:
        behavior = request.json['behavior']
        result = get_recommond_ids(behavior)
        return res_success(result)
    else:
        return res_fail("请输入正确的参数")
예제 #2
0
def check_feature_info():
    image_id = request.args.get('imageId')
    if image_id:
        result = lib.checkFeature(image_id)
        if result == -1:
            return res_fail("检测失败")
        return res_success()
    return res_fail("检测失败")
예제 #3
0
def open_camera():
    if 'cameraNum' not in request.json:
        return res_fail("摄像头编号不能为空")
    camera_num = request.json["cameraNum"]
    result = lib.openCamera(int(camera_num))
    if result == -1:
        return res_fail("开启失败")
    else:
        return res_success()
예제 #4
0
def update_second_model():
    if 'id' in request.json and 'recordId' in request.json:
        id = request.json['id']
        recordId = request.json['recordId']
        result = lib.updateSecondFaceModel(id, recordId)
        if result == 1:
            return res_success()
        else:
            return res_fail()
    return res_fail("请输入正确的参数")
예제 #5
0
def close_camera():
    if 'cameraNum' in request.json:
        camera_num = request.json["cameraNum"]
        result = lib.freeOneCamera(int(camera_num))
        if result == 0:
            return res_fail("关闭失败")
        else:
            return res_success()
    else:
        return res_fail("摄像头编号不能为空")
예제 #6
0
def add_face_model():
    if 'id' in request.json and 'imageId' in request.json and 'isActived' in request.json:
        id = request.json['id']
        imageId = request.json['imageId']
        is_actived = request.json['isActived']
        result = lib.addModel(id, imageId, is_actived)
        if result == 1:
            return res_success()
        else:
            return res_fail("人脸检测失败, 请重新上传")
    return res_fail("请输入正确的参数")
예제 #7
0
def age_test():
    if 'id' in request.json and 'attachId' in request.json:
        id = request.json['id']
        attachId = request.json['attachId']
        result = ctypes.c_float()
        lib.ageText(id, attachId, byref(result))
        if result.value != -1:
            return res_success(result.value)
        else:
            return res_fail("开门失败")
    return res_fail("请输入正确的参数")
예제 #8
0
def open_door_by_phone():
    # if 'type' in request.json:
    #     type = request.json['type']
    #     result = lib.writeFd(type)
    #     if result == 1:
    #         return res_success()
    #     else:
    #         return res_fail("开门失败")
    # return res_fail("请输入正确的参数")
    lib.openDoorByPhont()
    return res_success()
예제 #9
0
def get_cameras_info():
    getAllCameraInfo = lib.getAllCameraInfo
    getAllCameraInfo.restype = c_char_p
    data = getAllCameraInfo()
    return res_success(data)
예제 #10
0
def close_cameras():
    lib.freeAllCamera()
    return res_success()