Hydrospheredata/hydro-serving

Test failed

Closed this issue · 2 comments

Test Error

status: 500, error: InternalUncaught, message: UNKNOWN: Exception calling application: module 'func_main' has no attribute 'Predict'

This error occur during application Test.

Here is the code for func_main:

model = joblib.load("LightGBM/model/forecaster.pkl");

def predict(**kwargs):

try:

    input_data = {};

    for key, value in kwargs.items():
        input_data[key] = value.double_val;

    data_frame = pd.DataFrame.from_dict(input_data);
    prediction = model.predict(data_frame).tolist();

    prediction_tensor_shape = hs.TensorShapeProto(dim=[hs.TensorShapeProto.Dim(size=len(prediction))]);
    status_tensor_shape = hs.TensorShapeProto(dim=[hs.TensorShapeProto.Dim(size=1)]);

    status = [b"Ok"];

    return hs.PredictResponse(outputs = {"prediction": hs.TensorProto(dtype = hs.DT_DOUBLE, double_val = prediction, tensor_shape = prediction_tensor_shape), \
        "status": hs.TensorProto(dtype = hs.DT_STRING, string_val = status, tensor_shape = status_tensor_shape)});

except Exception as exception:
    
    status = [repr(exception).encode("utf-8")]
    prediction = [0.00];
    
    tensor_shape = hs.TensorShapeProto(dim=[hs.TensorShapeProto.Dim(size=1)]);

    return hs.PredictResponse(outputs = {"prediction": hs.TensorProto(dtype = hs.DT_DOUBLE, double_val = prediction, tensor_shape = tensor_shape), \
        "status": hs.TensorProto(dtype = hs.DT_STRING, string_val = status, tensor_shape = tensor_shape)});
stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.