MachineLearning class

Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

The Firebase MachineLearning service interface.

Signature:

export declare class MachineLearning 

Properties

Property Modifiers Type Description
app App The App 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 App associated with the current MachineLearning service instance.

Signature:

get app(): App;

MachineLearning.createModel()

Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Creates a model in the current Firebase project.

Signature:

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

Parameters

Parameter Type Description
model ModelOptions The model to create.

Returns:

Promise<Model>

A Promise fulfilled with the created model.

MachineLearning.deleteModel()

Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

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()

Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

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.

Returns:

Promise<Model>

A Promise fulfilled with the model object.

MachineLearning.listModels()

Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Lists the current project's models.

Signature:

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

Parameters

Parameter Type Description
options ListModelsOptions The listing options.

Returns:

Promise<ListModelsResult>

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.

MachineLearning.publishModel()

Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

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.

Returns:

Promise<Model>

A Promise fulfilled with the published model.

MachineLearning.unpublishModel()

Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

Unpublishes a Firebase ML model.

Signature:

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

Parameters

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

Returns:

Promise<Model>

A Promise fulfilled with the unpublished model.

MachineLearning.updateModel()

Firebase ML is deprecated and will be shut down on June 15, 2027. To host custom models, you must migrate to another solution. You can use Cloud Storage for Firebase as an alternative for hosting custom models. For more info, see https://firebase.google.com/docs/ml/migrate-to-cloud-storage

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.

Returns:

Promise<Model>

A Promise fulfilled with the updated model.