private async Task <IEnumerable <PredictionResult> > GetPredictionResults() { var data = _account.StatementData.Details .Select(x => new PredictionRequest { Bank = _account.Institution, Description = x.Text, Amount = x.Amount }); var predictionModel = await _predict.PredictManyAsync(data.AsEnumerable()); return(predictionModel); }
public async Task PredictAsync(PredictBankStatement2Command command, IPredict predict) { var results = await predict.PredictManyAsync(State.PredictionRequests); var predictionResults = results as PredictionResult[] ?? results.ToArray(); if (predictionResults.Any(x => x == null)) { throw new ApplicationException(); } var ev = new BankStatementPredicted2Event { PredictionResults = predictionResults }; Emit(ev); await Task.CompletedTask; }