Created
May 17, 2018 00:26
-
-
Save elbruno/b087dfa3303c040fdfa583539aa315e0 to your computer and use it in GitHub Desktop.
MLNetLoadModel.cs
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
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