@@ -86,7 +86,6 @@ class PhotoReasoningViewModel(
8686
8787 private var llmInference: LlmInference ? = null
8888 private var liteRtEngine: Engine ? = null
89- private var liteRtNativeLoaded = false
9089 private val TAG = " PhotoReasoningViewModel"
9190
9291 // WebRTC & Signaling
@@ -344,11 +343,10 @@ class PhotoReasoningViewModel(
344343 " abis=${Build .SUPPORTED_ABIS ?.joinToString() ? : " unknown" } , " +
345344 " modelPath=${modelFile.absolutePath} , modelSizeBytes=${modelFile.length()} "
346345 )
347- ensureLiteRtNativeLoaded()
348346 if (liteRtEngine == null ) {
349- val liteRtBackend = if (backend == InferenceBackend .GPU ) Backend .GPU else Backend .CPU
350- val visionBackend = Backend .CPU
351- val audioBackend = Backend . CPU
347+ val liteRtBackend = if (backend == InferenceBackend .GPU ) Backend .GPU () else Backend .CPU ()
348+ val visionBackend = if (currentModel.supportsScreenshot) Backend .GPU () else null
349+ val audioBackend = null
352350 val engineConfig = EngineConfig (
353351 modelPath = modelFile.absolutePath,
354352 backend = liteRtBackend,
@@ -413,14 +411,6 @@ class PhotoReasoningViewModel(
413411 }
414412 }
415413
416- private fun ensureLiteRtNativeLoaded () {
417- if (liteRtNativeLoaded) return
418-
419- System .loadLibrary(" litertlm_jni" )
420-
421- liteRtNativeLoaded = true
422- }
423-
424414 private fun isLiteRtAbiSupported (): Boolean {
425415 val supportedAbis = Build .SUPPORTED_ABIS ?.toSet().orEmpty()
426416 return supportedAbis.contains(" arm64-v8a" ) || supportedAbis.contains(" x86_64" )
0 commit comments