package com.sd.hmct_small_model

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import com.sd.hmct_small_model.databinding.ActivityMainBinding

class MainActivity : AppCompatActivity() {

    private lateinit var binding: ActivityMainBinding

    val pyTorchVm: PyTorchVm by viewModels()
//    val tensorFlowVm: TensorFlowVm by viewModels()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)
//        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
//            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
//            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
//            insets
//        }

//        mainVm.readVocab(this)
//        mainVm.initialize(this)

//        tensorFlowVm.initialize(this)
        pyTorchVm.initialize(this)

        setLis()
    }


    private fun setLis() {
        binding.bt1.setOnClickListener {
            var str = binding.et.text.toString()
            pyTorchVm.analyzeText(str)
        }
    }


    override fun onDestroy() {
        super.onDestroy()
        pyTorchVm.clean()
    }

}