This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

fix: model recreation

+22
+5
posedetection/src/androidMain/kotlin/com/performancecoachlab/posedetection/custom/CustomObjectModel.android.kt
··· 399 399 } 400 400 }.getOrDefault("") 401 401 } 402 + 403 + @Composable 404 + internal actual fun platformRememberObjectModel(modelPath: ModelPath): ObjectModel { 405 + return ObjectModelProvider.get(modelPath) 406 + }
+10
posedetection/src/commonMain/kotlin/com/performancecoachlab/posedetection/custom/CustomObjectModel.kt
··· 18 18 expect class ObjectModel { 19 19 } 20 20 21 + @Composable 22 + fun rememberObjectModel(modelPath: ModelPath): ObjectModel { 23 + // Android: cache via provider to avoid recreation 24 + // iOS: do NOT share/cross-cache the model; create once per composition 25 + return platformRememberObjectModel(modelPath) 26 + } 27 + 28 + @Composable 29 + internal expect fun platformRememberObjectModel(modelPath: ModelPath): ObjectModel 30 + 21 31 object ObjectModelProvider { 22 32 @Volatile private var cached: ObjectModel? = null 23 33
+7
posedetection/src/iosMain/kotlin/com/performancecoachlab/posedetection/custom/CustomObjectModel.ios.kt
··· 1 1 package com.performancecoachlab.posedetection.custom 2 2 3 3 import androidx.compose.runtime.Composable 4 + import androidx.compose.runtime.remember 4 5 import kotlinx.cinterop.ExperimentalForeignApi 5 6 import platform.CoreML.MLModel 6 7 import platform.Foundation.NSBundle ··· 38 39 fun getModel(): VNCoreMLModel? { 39 40 return model 40 41 } 42 + } 43 + 44 + @Composable 45 + internal actual fun platformRememberObjectModel(modelPath: ModelPath): ObjectModel { 46 + // iOS: create once for this composition; avoids global caching issues 47 + return initialiseObjectModel(modelPath) 41 48 }