Spaces:
Configuration error
Configuration error
Commit
·
1da156f
1
Parent(s):
28d5985
update model
Browse files- README.md +0 -11
- sherpa-onnx-asr.js +49 -2
- sherpa-onnx-wasm-main-asr.data +3 -0
- sherpa-onnx-wasm-main-asr.js +0 -0
- sherpa-onnx-wasm-main-asr.wasm +3 -0
- style.css +0 -28
README.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: Web Assembly Asr Sherpa Onnx En
|
| 3 |
-
emoji: ⚡
|
| 4 |
-
colorFrom: pink
|
| 5 |
-
colorTo: pink
|
| 6 |
-
sdk: static
|
| 7 |
-
pinned: false
|
| 8 |
-
license: apache-2.0
|
| 9 |
-
---
|
| 10 |
-
|
| 11 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sherpa-onnx-asr.js
CHANGED
|
@@ -35,6 +35,10 @@ function freeConfig(config, Module) {
|
|
| 35 |
freeConfig(config.whisper, Module)
|
| 36 |
}
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
if ('moonshine' in config) {
|
| 39 |
freeConfig(config.moonshine, Module)
|
| 40 |
}
|
|
@@ -651,6 +655,35 @@ function initSherpaOnnxOfflineMoonshineModelConfig(config, Module) {
|
|
| 651 |
}
|
| 652 |
}
|
| 653 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 654 |
function initSherpaOnnxOfflineTdnnModelConfig(config, Module) {
|
| 655 |
const n = Module.lengthBytesUTF8(config.model || '') + 1;
|
| 656 |
const buffer = Module._malloc(n);
|
|
@@ -755,6 +788,13 @@ function initSherpaOnnxOfflineModelConfig(config, Module) {
|
|
| 755 |
};
|
| 756 |
}
|
| 757 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 758 |
if (!('tdnn' in config)) {
|
| 759 |
config.tdnn = {
|
| 760 |
model: '',
|
|
@@ -789,8 +829,11 @@ function initSherpaOnnxOfflineModelConfig(config, Module) {
|
|
| 789 |
const moonshine =
|
| 790 |
initSherpaOnnxOfflineMoonshineModelConfig(config.moonshine, Module);
|
| 791 |
|
|
|
|
|
|
|
|
|
|
| 792 |
const len = transducer.len + paraformer.len + nemoCtc.len + whisper.len +
|
| 793 |
-
tdnn.len + 8 * 4 + senseVoice.len + moonshine.len;
|
| 794 |
|
| 795 |
const ptr = Module._malloc(len);
|
| 796 |
|
|
@@ -884,11 +927,15 @@ function initSherpaOnnxOfflineModelConfig(config, Module) {
|
|
| 884 |
offset += senseVoice.len;
|
| 885 |
|
| 886 |
Module._CopyHeap(moonshine.ptr, moonshine.len, ptr + offset);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 887 |
|
| 888 |
return {
|
| 889 |
buffer: buffer, ptr: ptr, len: len, transducer: transducer,
|
| 890 |
paraformer: paraformer, nemoCtc: nemoCtc, whisper: whisper, tdnn: tdnn,
|
| 891 |
-
senseVoice: senseVoice, moonshine: moonshine,
|
| 892 |
}
|
| 893 |
}
|
| 894 |
|
|
|
|
| 35 |
freeConfig(config.whisper, Module)
|
| 36 |
}
|
| 37 |
|
| 38 |
+
if ('fireRedAsr' in config) {
|
| 39 |
+
freeConfig(config.fireRedAsr, Module)
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
if ('moonshine' in config) {
|
| 43 |
freeConfig(config.moonshine, Module)
|
| 44 |
}
|
|
|
|
| 655 |
}
|
| 656 |
}
|
| 657 |
|
| 658 |
+
function initSherpaOnnxOfflineFireRedAsrModelConfig(config, Module) {
|
| 659 |
+
const encoderLen = Module.lengthBytesUTF8(config.encoder || '') + 1;
|
| 660 |
+
const decoderLen = Module.lengthBytesUTF8(config.decoder || '') + 1;
|
| 661 |
+
|
| 662 |
+
const n = encoderLen + decoderLen;
|
| 663 |
+
const buffer = Module._malloc(n);
|
| 664 |
+
|
| 665 |
+
const len = 2 * 4; // 2 pointers
|
| 666 |
+
const ptr = Module._malloc(len);
|
| 667 |
+
|
| 668 |
+
let offset = 0;
|
| 669 |
+
Module.stringToUTF8(config.encoder || '', buffer + offset, encoderLen);
|
| 670 |
+
offset += encoderLen;
|
| 671 |
+
|
| 672 |
+
Module.stringToUTF8(config.decoder || '', buffer + offset, decoderLen);
|
| 673 |
+
offset += decoderLen;
|
| 674 |
+
|
| 675 |
+
offset = 0;
|
| 676 |
+
Module.setValue(ptr, buffer + offset, 'i8*');
|
| 677 |
+
offset += encoderLen;
|
| 678 |
+
|
| 679 |
+
Module.setValue(ptr + 4, buffer + offset, 'i8*');
|
| 680 |
+
offset += decoderLen;
|
| 681 |
+
|
| 682 |
+
return {
|
| 683 |
+
buffer: buffer, ptr: ptr, len: len,
|
| 684 |
+
}
|
| 685 |
+
}
|
| 686 |
+
|
| 687 |
function initSherpaOnnxOfflineTdnnModelConfig(config, Module) {
|
| 688 |
const n = Module.lengthBytesUTF8(config.model || '') + 1;
|
| 689 |
const buffer = Module._malloc(n);
|
|
|
|
| 788 |
};
|
| 789 |
}
|
| 790 |
|
| 791 |
+
if (!('fireRedAsr' in config)) {
|
| 792 |
+
config.fireRedAsr = {
|
| 793 |
+
encoder: '',
|
| 794 |
+
decoder: '',
|
| 795 |
+
};
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
if (!('tdnn' in config)) {
|
| 799 |
config.tdnn = {
|
| 800 |
model: '',
|
|
|
|
| 829 |
const moonshine =
|
| 830 |
initSherpaOnnxOfflineMoonshineModelConfig(config.moonshine, Module);
|
| 831 |
|
| 832 |
+
const fireRedAsr =
|
| 833 |
+
initSherpaOnnxOfflineFireRedAsrModelConfig(config.fireRedAsr, Module);
|
| 834 |
+
|
| 835 |
const len = transducer.len + paraformer.len + nemoCtc.len + whisper.len +
|
| 836 |
+
tdnn.len + 8 * 4 + senseVoice.len + moonshine.len + fireRedAsr.len;
|
| 837 |
|
| 838 |
const ptr = Module._malloc(len);
|
| 839 |
|
|
|
|
| 927 |
offset += senseVoice.len;
|
| 928 |
|
| 929 |
Module._CopyHeap(moonshine.ptr, moonshine.len, ptr + offset);
|
| 930 |
+
offset += moonshine.len;
|
| 931 |
+
|
| 932 |
+
Module._CopyHeap(fireRedAsr.ptr, fireRedAsr.len, ptr + offset);
|
| 933 |
+
offset += fireRedAsr.len;
|
| 934 |
|
| 935 |
return {
|
| 936 |
buffer: buffer, ptr: ptr, len: len, transducer: transducer,
|
| 937 |
paraformer: paraformer, nemoCtc: nemoCtc, whisper: whisper, tdnn: tdnn,
|
| 938 |
+
senseVoice: senseVoice, moonshine: moonshine, fireRedAsr: fireRedAsr
|
| 939 |
}
|
| 940 |
}
|
| 941 |
|
sherpa-onnx-wasm-main-asr.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a379a74e2ff917765f3a9939afd0f52b73b12911b48a2deb0f4a429f3e6c5636
|
| 3 |
+
size 190951040
|
sherpa-onnx-wasm-main-asr.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
sherpa-onnx-wasm-main-asr.wasm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5abd78340d8f3fa13de33f33568f0b22fb73bc11c34e98d48c91b90e63a5d581
|
| 3 |
+
size 11505577
|
style.css
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
body {
|
| 2 |
-
padding: 2rem;
|
| 3 |
-
font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
|
| 4 |
-
}
|
| 5 |
-
|
| 6 |
-
h1 {
|
| 7 |
-
font-size: 16px;
|
| 8 |
-
margin-top: 0;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
p {
|
| 12 |
-
color: rgb(107, 114, 128);
|
| 13 |
-
font-size: 15px;
|
| 14 |
-
margin-bottom: 10px;
|
| 15 |
-
margin-top: 5px;
|
| 16 |
-
}
|
| 17 |
-
|
| 18 |
-
.card {
|
| 19 |
-
max-width: 620px;
|
| 20 |
-
margin: 0 auto;
|
| 21 |
-
padding: 16px;
|
| 22 |
-
border: 1px solid lightgray;
|
| 23 |
-
border-radius: 16px;
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
.card p:last-child {
|
| 27 |
-
margin-bottom: 0;
|
| 28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|