Example #1
0
        public async Task Predict_test_sample(string description, string bank, string subcategory)
        {
            var result = await _predict.PredictAsync(new PredictionRequest
            {
                Description = description,
                Bank        = bank
            });

            Console.WriteLine(result);
            result.Should().Be(subcategory);
        }
Example #2
0
        public async Task <IActionResult> Search(PredictionRequest request)
        {
            Guard.AgainstNull(request);

            using (LogContext.PushProperty("request", request.ToJson()))
                using (LogContext.PushProperty("requestId", request.Id))
                {
                    try
                    {
                        var result = await _predictor.PredictAsync(request);

                        return(Ok(result));
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        Log.Warning(e, "PredictionController error {request}", request.ToJson());
                        return(NoContent());
                    }
                }
        }