The Firebase MachineLearning service interface.

Signature:

export declare class MachineLearning 

Properties

Property Modifiers Type Description
app App The associated with the current MachineLearning service instance.

Methods

Method Modifiers Description
createModel(model) Creates a model in the current Firebase project.
deleteModel(modelId) Deletes a model from the current project.
getModel(modelId) Gets the model specified by the given ID.
listModels(options) Lists the current project's models.
publishModel(modelId) Publishes a Firebase ML model.A published model can be downloaded to client apps.
unpublishModel(modelId) Unpublishes a Firebase ML model.
updateModel(modelId, model) Updates a model's metadata or model file.

MachineLearning.app

The associated with the current MachineLearning service instance.

Signature:

get app(): App;

MachineLearning.createModel()

Creates a model in the current Firebase project.

Signature:

createModel(model: ModelOptions): Promise<Model>;

Parameters

Parameter Type Description
model ModelOptions The model to create. A Promise fulfilled with the created model.

Returns:

Promise<Model>

MachineLearning.deleteModel()

Deletes a model from the current project.

Signature:

deleteModel(modelId: string): Promise<void>;

Parameters

Parameter Type Description
modelId string The ID of the model to delete.

Returns:

Promise<void>

MachineLearning.getModel()

Gets the model specified by the given ID.

Signature:

getModel(modelId: string): Promise<Model>;

Parameters

Parameter Type Description
modelId string The ID of the model to get. A Promise fulfilled with the model object.

Returns:

Promise<Model>

MachineLearning.listModels()

Lists the current project's models.

Signature:

listModels(options?: ListModelsOptions): Promise<ListModelsResult>;

Parameters

Parameter Type Description
options ListModelsOptions The listing options. A promise that resolves with the current (filtered) list of models and the next page token. For the last page, an empty list of models and no page token are returned.

Returns:

Promise<ListModelsResult>

MachineLearning.publishModel()

Publishes a Firebase ML model.

A published model can be downloaded to client apps.

Signature:

publishModel(modelId: string): Promise<Model>;

Parameters

Parameter Type Description
modelId string The ID of the model to publish. A Promise fulfilled with the published model.

Returns:

Promise<Model>

MachineLearning.unpublishModel()

Unpublishes a Firebase ML model.

Signature:

unpublishModel(modelId: string): Promise<Model>;

Parameters

Parameter Type Description
modelId string The ID of the model to unpublish. A Promise fulfilled with the unpublished model.

Returns:

Promise<Model>

MachineLearning.updateModel()

Updates a model's metadata or model file.

Signature:

updateModel(modelId: string, model: ModelOptions): Promise<Model>;

Parameters

Parameter Type Description
modelId string The ID of the model to update.
model ModelOptions The model fields to update. A Promise fulfilled with the updated model.

Returns:

Promise<Model>