AI-generated Key Takeaways
-
LocalModel.Builder
is used to construct instances ofLocalModel
for using custom machine learning models in your Android app. -
You must specify the model's location using one of the provided methods:
setAbsoluteFilePath
,setAbsoluteManifestFilePath
,setAssetFilePath
,setAssetManifestFilePath
, orsetUri
. -
Once the model's location is set, call
build()
to create theLocalModel
instance. -
Ensure your asset model files are not compressed for proper loading.
Builder class of LocalModel
.
Only call one of
setAbsoluteFilePath(String)
,
setAbsoluteManifestFilePath(String)
,
setAssetFilePath(String)
,
setAssetManifestFilePath(String)
and
setUri(Uri)
.
Public Constructor Summary
Builder()
|
Public Method Summary
LocalModel |
build()
Builds an instance of
LocalModel
with provided info.
|
LocalModel.Builder | |
LocalModel.Builder |
setAbsoluteManifestFilePath(String
absoluteManifestFilePath)
Sets the absolute file path of the local model's manifest file.
|
LocalModel.Builder | |
LocalModel.Builder |
setAssetManifestFilePath(String
assetManifestFilePath)
Sets the asset subpath of the asset model's manifest file.
|
LocalModel.Builder |
Inherited Method Summary
Public Constructors
public Builder ()
Public Methods
public LocalModel build ()
Builds an instance of LocalModel
with provided info.
public LocalModel.Builder setAbsoluteFilePath (String absoluteFilePath)
Sets the absolute file path of the local model file.
public LocalModel.Builder setAbsoluteManifestFilePath (String absoluteManifestFilePath)
Sets the absolute file path of the local model's manifest file.
public LocalModel.Builder setAssetFilePath (String assetFilePath)
Sets the asset subpath of the asset model file.
Make sure your model asset file is not compressed by using aaptOptions. For more details, refer to documentation.
public LocalModel.Builder setAssetManifestFilePath (String assetManifestFilePath)
Sets the asset subpath of the asset model's manifest file.
Make sure your asset file is not compressed by using aaptOptions. For more details, refer to documentation.
public LocalModel.Builder setUri (Uri uri)
Sets the URI of the model file.
URI schemes can be content, android.resource or file. MlKitException
with error code MlKitException.NOT_FOUND
will be thrown when loading model if URI scheme is not one of 3 supported schemes.