private async Task LoadModelAsync()
        {
            //Load a machine learning model
            var modelFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///model.onnx"));

            ModelGen = await modelModel.CreateFromStreamAsync(modelFile);
        }
示例#2
0
        public static async Task <modelModel> CreateFromStreamAsync(IRandomAccessStreamReference stream)
        {
            modelModel learningModel = new modelModel();

            learningModel.model = await LearningModel.LoadFromStreamAsync(stream);

            learningModel.session = new LearningModelSession(learningModel.model,
                                                             new LearningModelDevice(LearningModelDeviceKind.Default));
            learningModel.binding = new LearningModelBinding(learningModel.session);
            return(learningModel);
        }