csukuangfj commited on
Commit
af2dbfa
1 Parent(s): 589e3d6

update model

Browse files
sherpa-onnx-asr.js CHANGED
@@ -869,7 +869,7 @@ class OfflineStream {
869
 
870
  free() {
871
  if (this.handle) {
872
- this.Module._DestroyOfflineStream(this.handle);
873
  this.handle = null;
874
  }
875
  }
@@ -882,7 +882,7 @@ class OfflineStream {
882
  const pointer =
883
  this.Module._malloc(samples.length * samples.BYTES_PER_ELEMENT);
884
  this.Module.HEAPF32.set(samples, pointer / samples.BYTES_PER_ELEMENT);
885
- this.Module._AcceptWaveformOffline(
886
  this.handle, sampleRate, pointer, samples.length);
887
  this.Module._free(pointer);
888
  }
@@ -892,7 +892,7 @@ class OfflineRecognizer {
892
  constructor(configObj, Module) {
893
  this.config = configObj;
894
  const config = initSherpaOnnxOfflineRecognizerConfig(configObj, Module);
895
- const handle = Module._CreateOfflineRecognizer(config.ptr);
896
  freeConfig(config, Module);
897
 
898
  this.handle = handle;
@@ -900,24 +900,25 @@ class OfflineRecognizer {
900
  }
901
 
902
  free() {
903
- this.Module._DestroyOfflineRecognizer(this.handle);
904
  this.handle = 0
905
  }
906
 
907
  createStream() {
908
- const handle = this.Module._CreateOfflineStream(this.handle);
909
  return new OfflineStream(handle, this.Module);
910
  }
911
 
912
  decode(stream) {
913
- this.Module._DecodeOfflineStream(this.handle, stream.handle);
914
  }
915
 
916
  getResult(stream) {
917
- const r = this.Module._GetOfflineStreamResultAsJson(stream.handle);
 
918
  const jsonStr = this.Module.UTF8ToString(r);
919
  const ans = JSON.parse(jsonStr);
920
- this.Module._DestroyOfflineStreamResultJson(r);
921
 
922
  return ans;
923
  }
@@ -933,7 +934,7 @@ class OnlineStream {
933
 
934
  free() {
935
  if (this.handle) {
936
- this.Module._DestroyOnlineStream(this.handle);
937
  this.handle = null;
938
  this.Module._free(this.pointer);
939
  this.pointer = null;
@@ -954,12 +955,12 @@ class OnlineStream {
954
  }
955
 
956
  this.Module.HEAPF32.set(samples, this.pointer / samples.BYTES_PER_ELEMENT);
957
- this.Module._AcceptWaveform(
958
  this.handle, sampleRate, this.pointer, samples.length);
959
  }
960
 
961
  inputFinished() {
962
- this.Module._InputFinished(this.handle);
963
  }
964
  };
965
 
@@ -967,7 +968,7 @@ class OnlineRecognizer {
967
  constructor(configObj, Module) {
968
  this.config = configObj;
969
  const config = initSherpaOnnxOnlineRecognizerConfig(configObj, Module)
970
- const handle = Module._CreateOnlineRecognizer(config.ptr);
971
 
972
  freeConfig(config, Module);
973
 
@@ -976,37 +977,39 @@ class OnlineRecognizer {
976
  }
977
 
978
  free() {
979
- this.Module._DestroyOnlineRecognizer(this.handle);
980
  this.handle = 0
981
  }
982
 
983
  createStream() {
984
- const handle = this.Module._CreateOnlineStream(this.handle);
985
  return new OnlineStream(handle, this.Module);
986
  }
987
 
988
  isReady(stream) {
989
- return this.Module._IsOnlineStreamReady(this.handle, stream.handle) == 1;
 
990
  }
991
 
992
  decode(stream) {
993
- this.Module._DecodeOnlineStream(this.handle, stream.handle);
994
  }
995
 
996
  isEndpoint(stream) {
997
- return this.Module._IsEndpoint(this.handle, stream.handle) == 1;
 
998
  }
999
 
1000
  reset(stream) {
1001
- this.Module._Reset(this.handle, stream.handle);
1002
  }
1003
 
1004
  getResult(stream) {
1005
- const r =
1006
- this.Module._GetOnlineStreamResultAsJson(this.handle, stream.handle);
1007
  const jsonStr = this.Module.UTF8ToString(r);
1008
  const ans = JSON.parse(jsonStr);
1009
- this.Module._DestroyOnlineStreamResultJson(r);
1010
 
1011
  return ans;
1012
  }
 
869
 
870
  free() {
871
  if (this.handle) {
872
+ this.Module._SherpaOnnxDestroyOfflineStream(this.handle);
873
  this.handle = null;
874
  }
875
  }
 
882
  const pointer =
883
  this.Module._malloc(samples.length * samples.BYTES_PER_ELEMENT);
884
  this.Module.HEAPF32.set(samples, pointer / samples.BYTES_PER_ELEMENT);
885
+ this.Module._SherpaOnnxAcceptWaveformOffline(
886
  this.handle, sampleRate, pointer, samples.length);
887
  this.Module._free(pointer);
888
  }
 
892
  constructor(configObj, Module) {
893
  this.config = configObj;
894
  const config = initSherpaOnnxOfflineRecognizerConfig(configObj, Module);
895
+ const handle = Module._SherpaOnnxCreateOfflineRecognizer(config.ptr);
896
  freeConfig(config, Module);
897
 
898
  this.handle = handle;
 
900
  }
901
 
902
  free() {
903
+ this.Module._SherpaOnnxDestroyOfflineRecognizer(this.handle);
904
  this.handle = 0
905
  }
906
 
907
  createStream() {
908
+ const handle = this.Module._SherpaOnnxCreateOfflineStream(this.handle);
909
  return new OfflineStream(handle, this.Module);
910
  }
911
 
912
  decode(stream) {
913
+ this.Module._SherpaOnnxDecodeOfflineStream(this.handle, stream.handle);
914
  }
915
 
916
  getResult(stream) {
917
+ const r =
918
+ this.Module._SherpaOnnxGetOfflineStreamResultAsJson(stream.handle);
919
  const jsonStr = this.Module.UTF8ToString(r);
920
  const ans = JSON.parse(jsonStr);
921
+ this.Module._SherpaOnnxDestroyOfflineStreamResultJson(r);
922
 
923
  return ans;
924
  }
 
934
 
935
  free() {
936
  if (this.handle) {
937
+ this.Module._SherpaOnnxDestroyOnlineStream(this.handle);
938
  this.handle = null;
939
  this.Module._free(this.pointer);
940
  this.pointer = null;
 
955
  }
956
 
957
  this.Module.HEAPF32.set(samples, this.pointer / samples.BYTES_PER_ELEMENT);
958
+ this.Module._SherpaOnnxOnlineStreamAcceptWaveform(
959
  this.handle, sampleRate, this.pointer, samples.length);
960
  }
961
 
962
  inputFinished() {
963
+ this.Module._SherpaOnnxOnlineStreamInputFinished(this.handle);
964
  }
965
  };
966
 
 
968
  constructor(configObj, Module) {
969
  this.config = configObj;
970
  const config = initSherpaOnnxOnlineRecognizerConfig(configObj, Module)
971
+ const handle = Module._SherpaOnnxCreateOnlineRecognizer(config.ptr);
972
 
973
  freeConfig(config, Module);
974
 
 
977
  }
978
 
979
  free() {
980
+ this.Module._SherpaOnnxDestroyOnlineRecognizer(this.handle);
981
  this.handle = 0
982
  }
983
 
984
  createStream() {
985
+ const handle = this.Module._SherpaOnnxCreateOnlineStream(this.handle);
986
  return new OnlineStream(handle, this.Module);
987
  }
988
 
989
  isReady(stream) {
990
+ return this.Module._SherpaOnnxIsOnlineStreamReady(
991
+ this.handle, stream.handle) == 1;
992
  }
993
 
994
  decode(stream) {
995
+ this.Module._SherpaOnnxDecodeOnlineStream(this.handle, stream.handle);
996
  }
997
 
998
  isEndpoint(stream) {
999
+ return this.Module._SherpaOnnxOnlineStreamIsEndpoint(
1000
+ this.handle, stream.handle) == 1;
1001
  }
1002
 
1003
  reset(stream) {
1004
+ this.Module._SherpaOnnxOnlineStreamReset(this.handle, stream.handle);
1005
  }
1006
 
1007
  getResult(stream) {
1008
+ const r = this.Module._SherpaOnnxGetOnlineStreamResultAsJson(
1009
+ this.handle, stream.handle);
1010
  const jsonStr = this.Module.UTF8ToString(r);
1011
  const ans = JSON.parse(jsonStr);
1012
+ this.Module._SherpaOnnxDestroyOnlineStreamResultJson(r);
1013
 
1014
  return ans;
1015
  }
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 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:08cc219c2112b1ee2fd094f5fe5a36eeab433042512ee233193ef071fb4a881b
3
- size 11336253
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ed30498d09ea41806ee09d0ebacf23ee0bc31062d839e2f764cbc5381dda5e7
3
+ size 11336394