From 1493ed67885d1d256a40ff41b0c6067053c0dc8d Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Thu, 12 Dec 2024 18:19:27 +0800 Subject: [PATCH] Add readme --- android/SherpaOnnxJavaDemo/README.md | 44 +++++++++++++++++++++ android/SherpaOnnxJavaDemo/app/build.gradle | 6 +-- 2 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 android/SherpaOnnxJavaDemo/README.md diff --git a/android/SherpaOnnxJavaDemo/README.md b/android/SherpaOnnxJavaDemo/README.md new file mode 100644 index 000000000..cf7d41557 --- /dev/null +++ b/android/SherpaOnnxJavaDemo/README.md @@ -0,0 +1,44 @@ +# Introduction + +Please run the following commands to download model files before you run this Android demo: + +```bash +# Assume we are inside +# /Users/fangjun/open-source/sherpa-onnx/android/SherpaOnnxJavaDemo + +cd app/src/main/assets/ +wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 + +tar xvf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 +rm sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20.tar.bz2 + +mv sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/encoder-epoch-99-avg-1.int8.onnx ./ +mv sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/decoder-epoch-99-avg-1.onnx ./ +mv sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/joiner-epoch-99-avg-1.int8.onnx ./ +mv sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/tokens.txt ./ + +rm -rf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20/* + +mv encoder-epoch-99-avg-1.int8.onnx ./ +mv decoder-epoch-99-avg-1.onnx ./ +mv joiner-epoch-99-avg-1.int8.onnx ./ +mv tokens.txt ./ +``` + +You should have the following directory structure: +``` +(py38) fangjuns-MacBook-Pro:assets fangjun$ pwd +/Users/fangjun/open-source/sherpa-onnx/android/SherpaOnnxJavaDemo/app/src/main/assets + +(py38) fangjuns-MacBook-Pro:assets fangjun$ tree . +. +└── sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 + ├── decoder-epoch-99-avg-1.onnx + ├── encoder-epoch-99-avg-1.int8.onnx + ├── joiner-epoch-99-avg-1.int8.onnx + └── tokens.txt + +1 directory, 4 files +``` + +Remember to remove unused files to reduce the file size of the final APK. diff --git a/android/SherpaOnnxJavaDemo/app/build.gradle b/android/SherpaOnnxJavaDemo/app/build.gradle index 595e011bf..a2ee27997 100644 --- a/android/SherpaOnnxJavaDemo/app/build.gradle +++ b/android/SherpaOnnxJavaDemo/app/build.gradle @@ -25,9 +25,6 @@ android { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } - sourceSets.main{ - jniLibs.srcDirs = ['jniLibs'] - } } dependencies { @@ -38,5 +35,4 @@ dependencies { implementation 'androidx.core:core-ktx:1.7.0' // implementation files('/Users/fangjun/open-source/sherpa-onnx/android/SherpaOnnxAar/sherpa_onnx/build/outputs/aar/sherpa_onnx-release.aar') implementation 'com.github.k2-fsa:sherpa-onnx:master-SNAPSHOT' - -} \ No newline at end of file +}