Skip to content

pypae/KMP-SAM

Repository files navigation

KmpSam

This is a Kotlin Multiplatform project targeting Android, iOS.

  • /composeApp is for code that will be shared across your Compose Multiplatform applications. It contains several subfolders:

    • commonMain is for code that’s common for all targets.
    • Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name. For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app, the iosMain folder would be the right place for such calls.
  • /iosApp contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform, you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.

Prerequisites

We're using cocoapods to manage the Obective-C dependencies in KMP. You need to install it, for example using homebrew:

brew install cocoapods

If there are issues with the cocoapods installation, see the KMP documentation on the cocoapods integration.

Build and Run Android Application

To build and run the development version of the Android app, use the run configuration from the run widget in your IDE’s toolbar or build it directly from the terminal:

  • on macOS/Linux
    ./gradlew :composeApp:assembleDebug
  • on Windows
    .\gradlew.bat :composeApp:assembleDebug

Build and Run iOS Application

To build and run the development version of the iOS app, run cd iosApp && pod install and open the /iosApp directory in Xcode. Then run it from there.

Setup

Before you can build the iOS app, you need to download the ONNX models and place them in the two folders: composeApp/src/androidMain/assets/models and iosApp/iosApp/Resources/models. Implementation tested with SAM 2.1 Tiny.

SAM 2.1 Tiny SAM 2.1 Small SAM 2.1 BasePlus SAM 2.1 Large

Unzip the files and copy the sam2.1_tiny.onnx as well as the sam2.1_tiny_preprocess.onnx file to the models folder.


Learn more about Kotlin Multiplatform

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors