Created
June 24, 2024 12:18
-
-
Save Adolfi/f0937da192b313373d1847a56f215fd8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpGet] | |
[Route("/api/ml/consume")] | |
public IActionResult Consume(string question) | |
{ | |
var loadedModel = context.Model.Load(Path.Combine(Directory.GetCurrentDirectory(), "data/faq-model.zip"), out var modelInputSchema); | |
var predictionEngine = context.Model.CreatePredictionEngine<FAQModel, PredictionModel>(loadedModel); | |
var prediction = predictionEngine.Predict(new FAQModel() { Question = question }); | |
return Ok(prediction.PredictedAnswer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment