blogs/tf_dataflow_serving/model/inference.py
def estimate_local(instances):
    """
    Calls the local babyweight estimator to get predictions

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

    init_predictor()

    inputs = dict((k, [v]) for k, v in instances[0].items())
    for i in range(1,len(instances)):
        instance = instances[i]

        for k, v in instance.items():
            inputs[k] += [v]

    values = predictor_fn(inputs)['predictions']
    return [value.item() for value in values.reshape(-1)]

    Calls the local babyweight estimator to get predictions

    Args:
       instances: list of json objects
    Returns:
        int - estimated baby weight
    
Calls the local babyweight estimator to get predictions
Calls the local babyweight estimator to get predictions
def estimate_local(instances):
    init_predictor()
    inputs = dict((k, [v]) for k, v in instances[0].items())
    for i in range(1,len(instances)):
        instance = instances[i]
        for k, v in instance.items():
            inputs[k] += [v]
    values = predictor_fn(inputs)['predictions']
    return [value.item() for value in values.reshape(-1)]
def estimate_local ( instances ) : init_predictor ( ) inputs = dict ( ( k , [ v ] ) for k , v in instances [ 0 ] . items ( ) ) for i in range ( 1 , len ( instances ) ) : instance = instances [ i ] for k , v in instance . items ( ) : inputs [ k ] += [ v ] values = predictor_fn ( inputs ) [ 'predictions' ] return [ value . item ( ) for value in values . reshape ( - 1 ) ]
Calls the local babyweight estimator to get predictions
Calls the local babyweight estimator to get predictions
"""
    Calls the local babyweight estimator 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