class NatML.MLModelDataEmbedAttribute
The MLModelDataEmbed attribute allows developers to embed model data from NatML Hub at build time so that the model data is available without downloading at runtime. This is useful when building applications that might not have internet access.
Note that the build size of the application will increase as a result of the embedded model data.

Embedding Model Data

/// <summary>
/// Embed ML model data from NatML.
/// </summary>
/// <param name="tag">Predictor tag.</param>
/// <param name="accessKey">NatML access key. If `null` the project access key will be used.</param>
MLModelDataEmbedAttribute (string tag, string accessKey = null);
The attribute can be placed on any class or struct definition. At build time, NatML will find all such attributes, and embed the corresponding model data in the build. The attribute can be used like so:
// An example script that embeds the `ssd-lite` model data from NatML Hub
class ObjectDetector : MonoBehaviour {
async void Start () {
// Fetch the model data from memory
// In a build, this will complete immediately
var modelData = await MLModelData.FromHub("@natsuite/ssd-lite");
// Use the model data
Copy link