CoreML.OpenModel
----------------

Opens a compiled model file.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CoreML](component_CoreML.md) | [7.4](newinversion74.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "CoreML.OpenModel"; Path ) 

**MBS**( **"CoreML.OpenModel";** /\* Opens a compiled model file. \*/  
**$Path**) /\* The path to the model file.e.g. "/test.mlmodelc" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The path to the model file. | "/test.mlmodelc" |

### Result

Returns OK or error.

### Description

Opens a compiled model file.  
If the model is not compiled (\*.mlmodel), you can compile it with [CoreML.CompileModel](CoreMLCompileModel.md).  
Returns error message if there is a problem.  
  
See also [Vision.ClassifyImage](VisionClassifyImage.md) to use Vision framework from Apple to classify images with Apple's model.  
### Examples

Load Model:

 Set Variable \[ $$ML ; Value: MBS ("CoreML.OpenModel"; CoreML::Model Path) \]   
If \[ MBS ("IsError") \]   
 Show Custom Dialog \[ "Failed to load" ; $$ML \]   
 Set Variable \[ $$ML ; Value: "" \]   
Else  
 Set Field \[ CoreML::Model Description ; MBS ("[CoreML.Description](CoreMLDescription.md)"; $$ML ) \]   
End If  
### See also

- [CoreML.CompileModel](CoreMLCompileModel.md)
- [CoreML.Description](CoreMLDescription.md)
- [IsError](IsError.md)
- [Vision.ClassifyImage](VisionClassifyImage.md)

### Example Databases

- [Mac and iOS/Machine Learning/Core ML Photos](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Machine%20Learning/Core%20ML%20Photos.shtml#6ScriptAnchor_)
- [Mac and iOS/Machine Learning/CoreML](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Machine%20Learning/CoreML.shtml#1ScriptAnchor_)

### Blog Entries

- [Train machine learning models on device](https://www.mbsplugins.de/archive/2019-12-17/Train_machine_learning_models_/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2022, Seite 26](https://filemaker-magazin.de/neuigkeit/4196-Appetithappen-FMM_202205)

This function checks for a license.

Created 16th September 2017 , last changed 17th October 2019

  
[CoreML.List](CoreMLList.md) - [CoreML.PredictionFromFeatures](CoreMLPredictionFromFeatures.md)

[HTML Version](CoreMLOpenModel.shtml)