public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            BuildUI();

            // Load the ML model
            var bundle    = NSBundle.MainBundle;
            var assetPath = bundle.GetUrlForResource("MarsHabitatPricer", "mlmodelc");

            model = MLModel.FromUrl(assetPath, out NSError mlErr);

            updatePredictedPrice();
        }
        void LoadModel()
        {
            var modelUrl = NSBundle.MainBundle.GetUrlForResource("SqueezeNet", "mlmodelc");

            model = MLModel.FromUrl(modelUrl, out var error);

            if (error != null)
            {
                Console.WriteLine($"Error loading model: {error}");
            }
            else
            {
                Console.WriteLine($"Loaded {model}");
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Configure UI
            CameraButton.Enabled  = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.Camera);
            GalleryButton.Enabled = UIImagePickerController.IsSourceTypeAvailable(UIImagePickerControllerSourceType.SavedPhotosAlbum);

            // Load the ML model
            var bundle    = NSBundle.MainBundle;
            var assetPath = bundle.GetUrlForResource("MNISTClassifier", "mlmodelc");
            var mlModel   = MLModel.FromUrl(assetPath, out NSError mlErr);
            var model     = VNCoreMLModel.FromMLModel(mlModel, out NSError vnErr);

            // Initialize
            RectangleRequest      = new VNDetectRectanglesRequest(HandleRectangles);
            ClassificationRequest = new VNCoreMLRequest(model, HandleClassification);
        }
        MLModel LoadModel(string modelName)
        {
            NSBundle bundle    = NSBundle.MainBundle;
            var      assetPath = bundle.GetUrlForResource(modelName, "mlmodelc");
            MLModel  mdl       = null;

            try
            {
                mdl = MLModel.FromUrl(assetPath, out var err);
                if (err != null)
                {
                    ErrorOccurred(this, new EventArgsT <string>(err.ToString()));
                }
            }
            catch (ArgumentNullException ane)
            {
                Console.WriteLine("*** VGG16 model probably hasn't been downloaded, built, and added to the project's Resources. Refer to the README for instructions. Error: " + ane.Message);
            }
            return(mdl);
        }