Model class

A Firebase ML Model output object.

Signature:

exportdeclareclassModel

Properties

PropertyModifiersTypeDescription
createTimestringThe timestamp of the model's creation.
displayNamestringThe model's name. This is the name you use from your app to load the model.
etagstringThe ETag identifier of the current version of the model. This value changes whenever you update any of the model's properties.
lockedbooleanTrue if the model is locked by a server-side operation. You can't make changes to a locked model. See Model.waitForUnlocked().
modelHashstring | undefinedThe hash of the model's tflite file. This value changes only when you upload a new TensorFlow Lite model.
modelIdstringThe ID of the model.
publishedbooleanTrue if the model is published.
tagsstring[]The model's tags, which can be used to group or filter models in list operations.
tfliteModelTFLiteModel | undefinedMetadata about the model's TensorFlow Lite model file.
updateTimestringThe timestamp of the model's most recent update.
validationErrorstring | undefinedError message when model validation fails.

Methods

MethodModifiersDescription
toJSON()Return the model as a JSON object.
waitForUnlocked(maxTimeMillis)Wait for the model to be unlocked.

Model.createTime

The timestamp of the model's creation.

Signature:

getcreateTime():string;

Model.displayName

The model's name. This is the name you use from your app to load the model.

Signature:

getdisplayName():string;

Model.etag

The ETag identifier of the current version of the model. This value changes whenever you update any of the model's properties.

Signature:

getetag():string;

Model.locked

True if the model is locked by a server-side operation. You can't make changes to a locked model. See Model.waitForUnlocked().

Signature:

getlocked():boolean;

Model.modelHash

The hash of the model's tflite file. This value changes only when you upload a new TensorFlow Lite model.

Signature:

getmodelHash():string|undefined;

Model.modelId

The ID of the model.

Signature:

getmodelId():string;

Model.published

True if the model is published.

Signature:

getpublished():boolean;

Model.tags

The model's tags, which can be used to group or filter models in list operations.

Signature:

gettags():string[];

Model.tfliteModel

Metadata about the model's TensorFlow Lite model file.

Signature:

gettfliteModel():TFLiteModel|undefined;

Model.updateTime

The timestamp of the model's most recent update.

Signature:

getupdateTime():string;

Model.validationError

Error message when model validation fails.

Signature:

getvalidationError():string|undefined;

Model.toJSON()

Return the model as a JSON object.

Signature:

toJSON():{[key:string]:any;};

Returns:

{ [key: string]: any; }

Model.waitForUnlocked()

Wait for the model to be unlocked.

Signature:

waitForUnlocked(maxTimeMillis?:number):Promise<void>;

Parameters

ParameterTypeDescription
maxTimeMillisnumberThe maximum time in milliseconds to wait. If not specified, a default maximum of 2 minutes is used.

Returns:

Promise<void>

A promise that resolves when the model is unlocked or the maximum wait time has passed.