ModelSelector

class ModelSelector 

ModelSelector allows to dynamically select a ModelProvider from a given set of providers.

Summary

Public constructors

ModelSelector (vararg modelProviders:  ModelProvider )

Public functions

suspend ModelProvider

Selects a ModelProvider from the given set based on the availability of model files and accelerators, in the order of NPU, GPU, CPU.

<Error class: unknown class> < ModelProvider >
selectModelFuture (
    env:  Environment ,
    lifecycleOwner:  <Error class: unknown class>
)

Returns a future that completes when the model is selected and ready to use.

Public constructors

ModelSelector

 ModelSelector 
(vararg modelProviders:  ModelProvider 
)

Public functions

selectModel

@ <Error class: unknown class> 

suspend fun  selectModel (env:  Environment ):  ModelProvider

Selects a ModelProvider from the given set based on the availability of model files and accelerators, in the order of NPU, GPU, CPU.

Returns
ModelProvider

the selected ModelProvider , which is guaranteed to be ready to use.

Throws
java.lang.IllegalStateException

if no model is available.

selectModelFuture

fun  selectModelFuture 
(
    env:  Environment ,
    lifecycleOwner:  <Error class: unknown class>
):  <Error class: unknown class> < ModelProvider >

Returns a future that completes when the model is selected and ready to use.

NOTE: Kotlin callers should use selectModel instead.

Create a Mobile Website
View Site in Mobile | Classic
Share by: