Skip to content

Instantly share code, notes, and snippets.

@elbruno
Created May 17, 2018 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elbruno/b087dfa3303c040fdfa583539aa315e0 to your computer and use it in GitHub Desktop.
Save elbruno/b087dfa3303c040fdfa583539aa315e0 to your computer and use it in GitHub Desktop.
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