def function_invoke()

in cvat-serverless/functions/views.py [0:0]


def function_invoke(request):
    """
    Invoke a function.
    """
    if request.method == 'POST':
        data = json.loads(request.body)
        if 'x-nuclio-function-name' in request.headers:
            if request.headers['x-nuclio-function-name'] == 'tf-faster-rcnn-inception-v2-coco':
                return tf_rcnn.call(data)
            elif request.headers['x-nuclio-function-name'] == 'pth-faster-rcnn':
                return pth_rcnn.call(data)
            elif request.headers['x-nuclio-function-name'] == 'pth-shiyinzhang-iog':
                return shiyinzhang_iog.call(data)
            elif request.headers['x-nuclio-function-name'] == 'pth-foolwood-siammask':
                return foolwood_siammask.call(data)
            elif request.headers['x-nuclio-function-name'] == 'openvino-person-reidentification-retail':
                return openvino_reidentification.call(data)
            else:
                return JsonResponse(NO_MODEL_ERR, status=406)
        else:
            return JsonResponse(NO_HEADER_ERR, status=406)
    else:
        return JsonResponse(NO_METHOD_ERR, status=405)