Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob] Use model path for session creation

Neeraj Gupta45b570367845
diff --git a/mobile/android/app/src/main/kotlin/io/ente/photos/ml/onnx/EnteOnnx.kt b/mobile/android/app/src/main/kotlin/io/ente/photos/ml/onnx/EnteOnnx.kt
index fc6205e82d..b301850681 100644
--- a/mobile/android/app/src/main/kotlin/io/ente/photos/ml/onnx/EnteOnnx.kt
+++ b/mobile/android/app/src/main/kotlin/io/ente/photos/ml/onnx/EnteOnnx.kt
@@ -117,9 +117,8 @@ class EnteOnnxFlutterPlugin : FlutterPlugin, MethodCallHandler {
sessionMap[modelType] = modelState
}
if (!modelState.isInitialized) {
- val modelBytes = readModelFile(modelPath)
for (i in 0 until sessionsCount) {
- val session = createSession(faceOrtEnv, modelBytes)
+ val session = createSession(faceOrtEnv, modelPath)
if (session != null) {
modelState.sessionAddresses[i] = session
}
@@ -192,8 +191,8 @@ class EnteOnnxFlutterPlugin : FlutterPlugin, MethodCallHandler {
}
}
- private fun createSession(env: OrtEnvironment, modelBytes: ByteArray): OrtSession? {
- return env.createSession(modelBytes, OrtSession.SessionOptions())
+ private fun createSession(env: OrtEnvironment, modalPath: String): OrtSession? {
+ return env.createSession(modalPath, OrtSession.SessionOptions())
}
private fun releaseAllSessions() {