public string GetPredict([FromBody] ModelInput input) { ComWebResponseEntity <string> result = new ComWebResponseEntity <string>(); ModelOutput prediction = _predictionEnginePool.Predict(modelName: "MLModel", example: input); result.Result = true; result.Content = prediction.Prediction + " 准确度:" + prediction.Score[0].ToString(); string jsonResult = result.ToJson(); return(jsonResult); }
public HttpResponseMessage GetPrediction([FromBody] ModelInput input) { ComWebResponseEntity <string> result = new ComWebResponseEntity <string>(); ModelOutput prediction = _predictionEnginePool.Predict(modelName: "MLModel", example: input); result.Result = true; result.Content = prediction.Prediction + " 准确度:" + prediction.Score[0].ToString(); string jsonResult = result.ToJson(); return(new HttpResponseMessage { Content = new StringContent(jsonResult, Encoding.UTF8, "application/json") }); }