def input_fn()

in 08_projects/modelbuild/pipelines/endtoendmlsm/deploy/xgboost/inference.py [0:0]


def input_fn(input_data, content_type):    
    if content_type == content_types.JSON:
        obj = json.loads(input_data)
        features = obj['instances'][0]['features']
        array = np.array(features).reshape((1, -1))
        return xgb.DMatrix(array)
    else:
        return xgb_encoders.decode(input_data, content_type)