Skip to content

Commit 91707ec

Browse files
authored
Support VAD+ASR for WearOS (#2404)
1 parent 462ffb0 commit 91707ec

File tree

32 files changed

+1102
-2
lines changed

32 files changed

+1102
-2
lines changed

.github/workflows/upload-models.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
git config --global user.name "Fangjun Kuang"
3232
3333
- name: FireRed ASR fp16
34+
if: false
3435
shell: bash
3536
env:
3637
HF_TOKEN: ${{ secrets.HF_TOKEN }}
@@ -64,17 +65,37 @@ jobs:
6465
- name: Zipformer CTC (non-streaming)
6566
if: false
6667
shell: bash
68+
env:
69+
MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
70+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
6771
run: |
6872
git lfs install
6973
names=(
7074
sherpa-onnx-zipformer-ctc-zh-int8-2025-07-03
7175
sherpa-onnx-zipformer-ctc-zh-2025-07-03
7276
sherpa-onnx-zipformer-ctc-zh-fp16-2025-07-03
77+
sherpa-onnx-zipformer-ctc-small-zh-int8-2025-07-16
78+
sherpa-onnx-zipformer-ctc-small-zh-fp16-2025-07-16
79+
sherpa-onnx-zipformer-ctc-small-zh-2025-07-16
7380
)
7481
for name in ${names[@]}; do
75-
git clone https://huggingface.co/csukuangfj/$name
82+
rm -rf ms
83+
git clone https://oauth2:${MS_TOKEN}@www.modelscope.cn/csukuangfj/$name.git ms
84+
git clone https://huggingface.co/csukuangfj/$name
85+
86+
cp -av ms/test_wavs $name
87+
cp -v ms/*.onnx $name
88+
cp -v ms/tokens.txt $name
89+
cp -v ms/bbpe.model $name
90+
7691
pushd $name
77-
git lfs pull
92+
git lfs track "*.wav" "*.onnx" "*.model"
93+
git add .
94+
git status
95+
git commit -m 'add models' || true
96+
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/$name main || true
97+
98+
# git lfs pull
7899
rm -rf .git
79100
rm -rfv .gitattributes
80101
ls -lh

android/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ for usage.
1919
|[SherpaOnnxAudioTagging](./SherpaOnnxAudioTagging)|[URL](https://k2-fsa.github.io/sherpa/onnx/audio-tagging/apk.html)| It shows how to use audio tagging.|
2020
|[SherpaOnnxAudioTaggingWearOS](./SherpaOnnxAudioTagging)|[URL](https://k2-fsa.github.io/sherpa/onnx/audio-tagging/apk-wearos.html)| It shows how to use audio tagging on WearOS.|
2121
|[SherpaOnnxSimulateStreamingAsr](./SherpaOnnxSimulateStreamingAsr)|| It shows how to use a non-streaming ASR model for streaming speech recognition.|
22+
|[SherpaOnnxSimulateStreamingAsrWearOs](./SherpaOnnxSimulateStreamingAsrWearOs)|| It shows how to use a non-streaming ASR model for streaming speech recognition with WearOS.|
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.jetbrains.kotlin.android)
4+
}
5+
6+
android {
7+
namespace = "com.k2fsa.sherpa.onnx.simulate.streaming.asr.wear.os"
8+
compileSdk = 34
9+
10+
defaultConfig {
11+
applicationId = "com.k2fsa.sherpa.onnx.simulate.streaming.asr.wear.os"
12+
minSdk = 28
13+
targetSdk = 34
14+
versionCode = 1
15+
versionName = "1.0"
16+
vectorDrawables {
17+
useSupportLibrary = true
18+
}
19+
20+
}
21+
22+
buildTypes {
23+
release {
24+
isMinifyEnabled = false
25+
proguardFiles(
26+
getDefaultProguardFile("proguard-android-optimize.txt"),
27+
"proguard-rules.pro"
28+
)
29+
}
30+
}
31+
compileOptions {
32+
sourceCompatibility = JavaVersion.VERSION_1_8
33+
targetCompatibility = JavaVersion.VERSION_1_8
34+
}
35+
kotlinOptions {
36+
jvmTarget = "1.8"
37+
}
38+
buildFeatures {
39+
compose = true
40+
}
41+
composeOptions {
42+
kotlinCompilerExtensionVersion = "1.5.1"
43+
}
44+
packaging {
45+
resources {
46+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
47+
}
48+
}
49+
}
50+
51+
dependencies {
52+
53+
implementation(libs.play.services.wearable)
54+
implementation(platform(libs.compose.bom))
55+
implementation(libs.ui)
56+
implementation(libs.ui.tooling.preview)
57+
implementation(libs.compose.material)
58+
implementation(libs.compose.foundation)
59+
implementation(libs.activity.compose)
60+
implementation(libs.core.splashscreen)
61+
implementation("com.github.k2-fsa:sherpa-onnx:v1.12.6")
62+
androidTestImplementation(platform(libs.compose.bom))
63+
androidTestImplementation(libs.ui.test.junit4)
64+
debugImplementation(libs.ui.tooling)
65+
debugImplementation(libs.ui.test.manifest)
66+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<lint>
3+
<!-- Ignore the IconLocation for the Tile preview images -->
4+
<issue id="IconLocation">
5+
<ignore path="res/drawable/tile_preview.png" />
6+
<ignore path="res/drawable-round/tile_preview.png" />
7+
</issue>
8+
</lint>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<uses-permission android:name="android.permission.WAKE_LOCK" />
5+
6+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
7+
8+
<uses-feature android:name="android.hardware.type.watch" />
9+
10+
<application
11+
android:allowBackup="true"
12+
android:icon="@mipmap/ic_launcher"
13+
android:label="@string/app_name"
14+
android:supportsRtl="true"
15+
android:theme="@android:style/Theme.DeviceDefault">
16+
<uses-library
17+
android:name="com.google.android.wearable"
18+
android:required="true" />
19+
20+
<!--
21+
Set to true if your app is Standalone, that is, it does not require the handheld
22+
app to run.
23+
-->
24+
<meta-data
25+
android:name="com.google.android.wearable.standalone"
26+
android:value="true" />
27+
28+
<activity
29+
android:name=".presentation.MainActivity"
30+
android:exported="true"
31+
android:taskAffinity=""
32+
android:theme="@style/MainActivityTheme.Starting">
33+
<intent-filter>
34+
<action android:name="android.intent.action.MAIN" />
35+
36+
<category android:name="android.intent.category.LAUNCHER" />
37+
</intent-filter>
38+
</activity>
39+
</application>
40+
41+
</manifest>

android/SherpaOnnxSimulateStreamingAsrWearOs/app/src/main/assets/.gitignore

Whitespace-only changes.

0 commit comments

Comments
 (0)