blogs/tf_dataflow_serving/model/inference.py
def estimate_cmle(instances):
    """
    Calls the babyweight estimator API on CMLE to get predictions

    Args:
       instances: list of json objects
    Returns:
        int - estimated baby weight
    """
    init_api()

    request_data = {'instances': instances}

    model_url = 'projects/{}/models/{}/versions/{}'.format(PROJECT, CMLE_MODEL_NAME, CMLE_MODEL_VERSION)
    response = cmle_api.projects().predict(body=request_data, name=model_url).execute()
    values = [item["predictions"][0] for item in response['predictions']]
    return values

    Calls the babyweight estimator API on CMLE to get predictions

    Args:
       instances: list of json objects
    Returns:
        int - estimated baby weight
    
Calls the babyweight estimator API on CMLE to get predictions
Calls the babyweight estimator API on CMLE to get predictions
def estimate_cmle(instances):
    init_api()
    request_data = {'instances': instances}
    model_url = 'projects/{}/models/{}/versions/{}'.format(PROJECT, CMLE_MODEL_NAME, CMLE_MODEL_VERSION)
    response = cmle_api.projects().predict(body=request_data, name=model_url).execute()
    values = [item["predictions"][0] for item in response['predictions']]
    return values
def estimate_cmle ( instances ) : init_api ( ) request_data = { 'instances' : instances } model_url = 'projects/{}/models/{}/versions/{}' . format ( PROJECT , CMLE_MODEL_NAME , CMLE_MODEL_VERSION ) response = cmle_api . projects ( ) . predict ( body = request_data , name = model_url ) . execute ( ) values = [ item [ "predictions" ] [ 0 ] for item in response [ 'predictions' ] ] return values
Calls the babyweight estimator API on CMLE to get predictions
Calls the babyweight estimator API on CMLE to get predictions
"""
    Calls the babyweight estimator API on CMLE to get predictions

    Args:
       instances: list of json objects
    Returns:
        int - estimated baby weight
    """
estimated baby weight
estimated baby weight
instances
list of json objects
list of json objects