FirebaseModelManager

public class FirebaseModelManager extends Object

Manages the registration of cloud and local models.

A model should be registered with FirebaseModelManager first before being used by FirebaseModelInterpreter. The model name is the key for a model, and a model name can only be registered once.

For cloud model, the model name should be the same name as that uploaded in Firebase Console.

This class is thread safe.

Public Method Summary

synchronized FirebaseCloudModelSource
getCloudModelSource(String modelName)
Gets the registered cloud model source based on the model name.
synchronized static FirebaseModelManager
getInstance()
Gets an instance of a FirebaseModelManager corresponding to the default FirebaseApp instance.
synchronized FirebaseLocalModelSource
getLocalModelSource(String modelName)
Gets the registered local model source based on the model name.
synchronized boolean
registerCloudModelSource(FirebaseCloudModelSource cloudModelSource)
Registers a cloud model for model interpreter to use later.
synchronized boolean
registerLocalModelSource(FirebaseLocalModelSource localModelSource)
Registers a local model for model interpreter to use later.

Inherited Method Summary

Public Methods

public synchronized FirebaseCloudModelSource getCloudModelSource (String modelName)

Gets the registered cloud model source based on the model name. Returns null if the model name is not registered.

public static synchronized FirebaseModelManager getInstance ()

Gets an instance of a FirebaseModelManager corresponding to the default FirebaseApp instance.

public synchronized FirebaseLocalModelSource getLocalModelSource (String modelName)

Gets the registered local model source based on the model name. Returns null if the model name is not registered.

public synchronized boolean registerCloudModelSource (FirebaseCloudModelSource cloudModelSource)

Registers a cloud model for model interpreter to use later. Cloud models are keyed by model names, and each model name can be registered at most once.

The model name should have the same model name when uploaded to the Firebase Console.

Returns
  • false if the model name is already registered, in which case you could use {getCloudModelSource(String)} to get the registered cloud model source. True if registration succeeds.
Throws
NullPointerException if cloudModelSource is null.

public synchronized boolean registerLocalModelSource (FirebaseLocalModelSource localModelSource)

Registers a local model for model interpreter to use later. Local models are keyed by model names, and each model name can be registered at most once.

Returns
  • false if the model name is already registered, and you could use {getLocalModelSource(String)} to get the registered local model source. True if registration succeeds.
Throws
NullPointerException if localModelSource is null.