Пример #1
0
        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);
        }
Пример #2
0
        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")
            });
        }