Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
MLNetLoadModel.cs
class Program
{
private static string _modelFilePath = "AgeRangeDataModel.zip";
private static PredictionModel<AgeRangeData, AgeRangePrediction> _model;
static void Main(string[] args)
{
LoadModel();
var prediction = _model.Predict(new AgeRangeData()
{
AgeStart = 1,
AgeEnd = 2
});
Console.WriteLine($"Predicted age range is: {prediction.PredictedLabels}");
Console.ReadLine();
}
private static async void LoadModel()
{
_model = await PredictionModel.ReadAsync<AgeRangeData, AgeRangePrediction>(_modelFilePath);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.