-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbaec8a
commit e3d273f
Showing
61 changed files
with
6,705 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
[workspace] | ||
members = ["crates/sherpa-rs", "crates/sherpa-rs-sys"] | ||
exclude = ["examples/tauri-app/src-tauri"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
schemas/ | ||
autogenerated/ | ||
src-tauri/icons/* | ||
!src-tauri/icons/icon.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Tauri + sherpa-rs | ||
|
||
See https://v2.tauri.app/start/prerequisites | ||
See [Building](../../BUILDING.md) | ||
|
||
Prepare model | ||
|
||
```console | ||
cd src-tauri | ||
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
tar xvf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
mv sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12/model.onnx model.onnx | ||
rm -rf rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12 | ||
rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
adb push model.onnx /data/local/tmp/model.onnx # currently hardcoded in the APK | ||
``` | ||
|
||
```console | ||
# Setup environment variables | ||
export JAVA_HOME="/Applications/Android Studio.app/Contents/jbr/Contents/Home" | ||
export ANDROID_HOME="$HOME/Library/Android/sdk" | ||
export NDK_HOME="$HOME/Library/Android/sdk/ndk/27.0.12077973" # ls $HOME/Library/Android/sdk/ndk | ||
|
||
# Setup UI | ||
bun install | ||
bunx tauri icon src-tauri/icons/icon.png | ||
|
||
cd src-tauri | ||
export CARGO_TARGET_DIR="$(pwd)/target" | ||
cargo ndk -t arm64-v8a build | ||
mkdir -p gen/android/app/src/main/jniLibs/arm64-v8a | ||
ln -s $(pwd)/target/aarch64-linux-android/debug/libonnxruntime.so $(pwd)/gen/android/app/src/main/jniLibs/arm64-v8a/libonnxruntime.so | ||
ln -s $(pwd)/target/aarch64-linux-android/debug/libsherpa-onnx-c-api.so $(pwd)/gen/android/app/src/main/jniLibs/arm64-v8a/libsherpa-onnx-c-api.so | ||
bun run tauri android dev | ||
``` | ||
|
||
## Debug | ||
|
||
```console | ||
adb logcat -c && adb logcat | grep -i -E "tauri|rust|sherpa" | ||
``` | ||
|
||
## Debug webview | ||
|
||
Open `chrome://inspect` in the chrome browser and click `inspect` |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<!-- <link rel="stylesheet" href="/src/styles.css" /> --> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>sherpa-rs with tauri</title> | ||
<script type="module" src="/src/main.ts" defer></script> | ||
<style> | ||
h1 { | ||
background-color: #8EC5FC; | ||
background-image: linear-gradient(62deg, #8EC5FC 0%, #E0C3FC 100%); | ||
-webkit-background-clip: text; /* Safari */ | ||
background-clip: text; /* For other modern browsers */ | ||
color: transparent; /* Make the text itself transparent */ | ||
} | ||
|
||
#input { | ||
width: 90%; | ||
height: 120px; | ||
border-radius: 12px; | ||
padding: 5px 5px; | ||
} | ||
|
||
.action { | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 10px; | ||
} | ||
|
||
button { | ||
background: #8EC5FC; | ||
color: white; | ||
border: none; | ||
padding: 5px 5px; | ||
|
||
font-size: 22px; | ||
border-radius: 12px; | ||
} | ||
|
||
#output { | ||
margin-top: 20px; | ||
padding: 10px; | ||
border-radius: 12px; | ||
background-color: #f4f4f9; | ||
font-size: 18px; | ||
color: #333; | ||
word-wrap: break-word; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<main class="container"> | ||
<h1 style="text-align: center;">sherpa-rs</h1> | ||
|
||
<form class="row" id="input-form"> | ||
<textarea id="input" placeholder="Type text to punctuate...">Hello how are you</textarea> | ||
<div class="action"> | ||
<button type="submit">Punctuate</button> | ||
</div> | ||
</form> | ||
<p id="output"></p> | ||
</main> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "tauri-app", | ||
"private": true, | ||
"version": "0.1.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "tsc && vite build", | ||
"preview": "vite preview", | ||
"tauri": "tauri" | ||
}, | ||
"dependencies": { | ||
"@tauri-apps/api": "^2", | ||
"@tauri-apps/plugin-opener": "^2" | ||
}, | ||
"devDependencies": { | ||
"@tauri-apps/cli": "^2", | ||
"vite": "^6.0.3", | ||
"typescript": "~5.6.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
/target/ | ||
|
||
# Generated by Tauri | ||
# will have schema files for capabilities auto-completion | ||
/gen/schemas |
Oops, something went wrong.