Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
doyeop-zeticai committed Jul 25, 2024
1 parent c9ee86f commit d7a0db1
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 3 deletions.
108 changes: 108 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Zetic MLange Android Sample App

Deploy to Android Studio
========================

Currently Java Native Interface is provided.

## Prerequisite

1. Model file

- Model file is provided by ZETIC.ai with URL. You can simply use the model url.

2. Aar Library

- Zetic MLange : `zeticMLange.aar`

## Android application project structure

```
app
└── libs
└── zeticlibs
└── zeticMLange.aar
```


## App settings

- build.gradle (Groovy)

``` gradle
android {
...
packagingOptions {
jniLibs {
useLegacyPackaging true
}
}
}
dependencies {
implementation files('libs/zeticlibs/zeticMLange.aar')
}
```
- build.gradle.kts (Kotlin DSL)

``` gradle
android {
...
packaging {
jniLibs {
useLegacyPackaging = true
}
}
}
dependencies {
implementation(files("libs/zeticlibs/zeticMLange.aar"))
}
```


## Application Implementation


1. Zetic MLange model running (Java)

``` java
// 1. Zetic MLange model running

// (1) Prepare model inputs
ByteBuffer[] inputs = // Prepare your inputs;

// (2) Load Zetic MLange model
ZeticMLangeModel model = new ZeticMLangeModel(this, "MLANGE MODEL KEY");

// (3) Run model and get outputs
model.run(inputs);

// (4) Get output buffers
ByteBuffer[] outputs = model.getOutputBuffers();
```

2. Zetic MLange model running (Kotlin)

``` kotlin
// 1. Zetic MLange Model Running

// (1) Prepare model inputs
val inputs: Array<ByteBuffer> = // Prepare your inputs

// (2) Load Zetic MLange model
val model = ZeticMLangeModel(this, "MODEL KEY")

// (3) Run model and get outputs
model.run(inputs)

// (4) Get output buffers
val outputs = model.outputBuffers
```
Binary file modified app/libs/zeticlibs/zeticMLange.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:theme="@style/Theme.ZeticMLangeAndroidSample"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:name=".KotlinActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.appcompat.app.AppCompatActivity
import com.zetic.ZeticMLange.ZeticMLangeModel
import java.nio.ByteBuffer

class MainActivity : AppCompatActivity() {
class KotlinActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
tools:context=".KotlinActivity">

<TextView
android:layout_width="wrap_content"
Expand Down

0 comments on commit d7a0db1

Please sign in to comment.