package com.performancecoachlab.posedetection.custom

import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext

@Composable
actual fun initialiseObjectModel(modelPath: ModelPath): ObjectModel {
    val options = org.tensorflow.lite.task.vision.detector.ObjectDetector.ObjectDetectorOptions.builder().setMaxResults(5).setScoreThreshold(0f).build()
    val detector = org.tensorflow.lite.task.vision.detector.ObjectDetector.createFromFileAndOptions(
        LocalContext.current,
        modelPath.androidModelPath,
        options
    )
    return ObjectModel(detector)
}

actual class ObjectModel{
    private var detector: org.tensorflow.lite.task.vision.detector.ObjectDetector? = null

    constructor(detector: org.tensorflow.lite.task.vision.detector.ObjectDetector){
        this.detector = detector
    }

    fun getDetector(): org.tensorflow.lite.task.vision.detector.ObjectDetector? {
        return detector
    }
}