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()
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()
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. |
Returns:
Promise<Model>
A Promise fulfilled with the model object.
MachineLearning.listModels()
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()
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()
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()
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.