Fangjun Kuang
Committed by GitHub

Refactor WebAssembly for nodejs (#626)

@@ -72,7 +72,7 @@ jobs: @@ -72,7 +72,7 @@ jobs:
72 path: ./sherpa-onnx-wasm-simd-*.tar.bz2 72 path: ./sherpa-onnx-wasm-simd-*.tar.bz2
73 73
74 - name: Publish to ModelScope 74 - name: Publish to ModelScope
75 - if: false 75 + # if: false
76 env: 76 env:
77 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }} 77 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
78 uses: nick-fields/retry@v2 78 uses: nick-fields/retry@v2
@@ -92,6 +92,9 @@ jobs: @@ -92,6 +92,9 @@ jobs:
92 git clone http://www.modelscope.cn/studios/k2-fsa/web-assembly-tts-sherpa-onnx-de.git ms 92 git clone http://www.modelscope.cn/studios/k2-fsa/web-assembly-tts-sherpa-onnx-de.git ms
93 93
94 cd ms 94 cd ms
  95 + rm -fv *.js
  96 + rm -fv *.data
  97 +
95 git fetch 98 git fetch
96 git pull 99 git pull
97 git merge -m "merge remote" --ff origin main 100 git merge -m "merge remote" --ff origin main
@@ -126,6 +129,8 @@ jobs: @@ -126,6 +129,8 @@ jobs:
126 129
127 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-tts-sherpa-onnx-de huggingface 130 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-tts-sherpa-onnx-de huggingface
128 cd huggingface 131 cd huggingface
  132 + rm -fv *.js
  133 + rm -fv *.data
129 git fetch 134 git fetch
130 git pull 135 git pull
131 git merge -m "merge remote" --ff origin main 136 git merge -m "merge remote" --ff origin main
@@ -74,7 +74,7 @@ jobs: @@ -74,7 +74,7 @@ jobs:
74 path: ./sherpa-onnx-wasm-simd-*.tar.bz2 74 path: ./sherpa-onnx-wasm-simd-*.tar.bz2
75 75
76 - name: Publish to ModelScope 76 - name: Publish to ModelScope
77 - if: false 77 + # if: false
78 env: 78 env:
79 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }} 79 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
80 uses: nick-fields/retry@v2 80 uses: nick-fields/retry@v2
@@ -93,6 +93,8 @@ jobs: @@ -93,6 +93,8 @@ jobs:
93 93
94 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-en.git ms 94 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-en.git ms
95 cd ms 95 cd ms
  96 + rm -fv *.js
  97 + rm -fv *.data
96 git fetch 98 git fetch
97 git pull 99 git pull
98 git merge -m "merge remote" --ff origin main 100 git merge -m "merge remote" --ff origin main
@@ -127,6 +129,8 @@ jobs: @@ -127,6 +129,8 @@ jobs:
127 129
128 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-en huggingface 130 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-en huggingface
129 cd huggingface 131 cd huggingface
  132 + rm -fv *.js
  133 + rm -fv *.data
130 git fetch 134 git fetch
131 git pull 135 git pull
132 git merge -m "merge remote" --ff origin main 136 git merge -m "merge remote" --ff origin main
@@ -70,7 +70,7 @@ jobs: @@ -70,7 +70,7 @@ jobs:
70 path: ./sherpa-onnx-wasm-simd-*.tar.bz2 70 path: ./sherpa-onnx-wasm-simd-*.tar.bz2
71 71
72 - name: Publish to ModelScope 72 - name: Publish to ModelScope
73 - if: false 73 + # if: false
74 env: 74 env:
75 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }} 75 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
76 uses: nick-fields/retry@v2 76 uses: nick-fields/retry@v2
@@ -89,6 +89,8 @@ jobs: @@ -89,6 +89,8 @@ jobs:
89 89
90 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-tts-sherpa-onnx-en.git ms 90 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-tts-sherpa-onnx-en.git ms
91 cd ms 91 cd ms
  92 + rm -fv *.js
  93 + rm -fv *.data
92 git fetch 94 git fetch
93 git pull 95 git pull
94 git merge -m "merge remote" --ff origin main 96 git merge -m "merge remote" --ff origin main
@@ -123,6 +125,8 @@ jobs: @@ -123,6 +125,8 @@ jobs:
123 125
124 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-tts-sherpa-onnx-en huggingface 126 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-tts-sherpa-onnx-en huggingface
125 cd huggingface 127 cd huggingface
  128 + rm -fv *.js
  129 + rm -fv *.data
126 git fetch 130 git fetch
127 git pull 131 git pull
128 git merge -m "merge remote" --ff origin main 132 git merge -m "merge remote" --ff origin main
@@ -99,6 +99,8 @@ jobs: @@ -99,6 +99,8 @@ jobs:
99 99
100 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer huggingface 100 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer huggingface
101 cd huggingface 101 cd huggingface
  102 + rm -fv *.js
  103 + rm -fv *.data
102 git fetch 104 git fetch
103 git pull 105 git pull
104 git merge -m "merge remote" --ff origin main 106 git merge -m "merge remote" --ff origin main
@@ -115,7 +117,7 @@ jobs: @@ -115,7 +117,7 @@ jobs:
115 git push https://csukuangfj:$HF_TOKEN@huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer main 117 git push https://csukuangfj:$HF_TOKEN@huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer main
116 118
117 - name: Publish to ModelScope 119 - name: Publish to ModelScope
118 - if: false 120 + # if: false
119 env: 121 env:
120 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }} 122 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
121 uses: nick-fields/retry@v2 123 uses: nick-fields/retry@v2
@@ -134,6 +136,8 @@ jobs: @@ -134,6 +136,8 @@ jobs:
134 136
135 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer.git ms 137 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-cantonese-en-paraformer.git ms
136 cd ms 138 cd ms
  139 + rm -fv *.js
  140 + rm -fv *.data
137 git config lfs.locksverify true 141 git config lfs.locksverify true
138 git fetch 142 git fetch
139 git pull 143 git pull
@@ -81,7 +81,7 @@ jobs: @@ -81,7 +81,7 @@ jobs:
81 path: ./sherpa-onnx-wasm-simd-*.tar.bz2 81 path: ./sherpa-onnx-wasm-simd-*.tar.bz2
82 82
83 - name: Publish to ModelScope 83 - name: Publish to ModelScope
84 - if: false 84 + # if: false
85 env: 85 env:
86 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }} 86 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
87 uses: nick-fields/retry@v2 87 uses: nick-fields/retry@v2
@@ -100,6 +100,8 @@ jobs: @@ -100,6 +100,8 @@ jobs:
100 100
101 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en-paraformer.git ms 101 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en-paraformer.git ms
102 cd ms 102 cd ms
  103 + rm -fv *.js
  104 + rm -fv *.data
103 git fetch 105 git fetch
104 git pull 106 git pull
105 git merge -m "merge remote" --ff origin main 107 git merge -m "merge remote" --ff origin main
@@ -134,6 +136,8 @@ jobs: @@ -134,6 +136,8 @@ jobs:
134 136
135 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en-paraformer huggingface 137 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en-paraformer huggingface
136 cd huggingface 138 cd huggingface
  139 + rm -fv *.js
  140 + rm -fv *.data
137 git fetch 141 git fetch
138 git pull 142 git pull
139 git merge -m "merge remote" --ff origin main 143 git merge -m "merge remote" --ff origin main
@@ -72,7 +72,7 @@ jobs: @@ -72,7 +72,7 @@ jobs:
72 path: ./sherpa-onnx-wasm-simd-*.tar.bz2 72 path: ./sherpa-onnx-wasm-simd-*.tar.bz2
73 73
74 - name: Publish to ModelScope 74 - name: Publish to ModelScope
75 - if: false 75 + # if: false
76 env: 76 env:
77 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }} 77 MS_TOKEN: ${{ secrets.MODEL_SCOPE_GIT_TOKEN }}
78 uses: nick-fields/retry@v2 78 uses: nick-fields/retry@v2
@@ -91,6 +91,8 @@ jobs: @@ -91,6 +91,8 @@ jobs:
91 91
92 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en.git ms 92 git clone https://www.modelscope.cn/studios/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en.git ms
93 cd ms 93 cd ms
  94 + rm -fv *.js
  95 + rm -fv *.data
94 git fetch 96 git fetch
95 git pull 97 git pull
96 git merge -m "merge remote" --ff origin main 98 git merge -m "merge remote" --ff origin main
@@ -125,6 +127,8 @@ jobs: @@ -125,6 +127,8 @@ jobs:
125 127
126 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en huggingface 128 git clone https://huggingface.co/spaces/k2-fsa/web-assembly-asr-sherpa-onnx-zh-en huggingface
127 cd huggingface 129 cd huggingface
  130 + rm -fv *.js
  131 + rm -fv *.data
128 git fetch 132 git fetch
129 git pull 133 git pull
130 git merge -m "merge remote" --ff origin main 134 git merge -m "merge remote" --ff origin main
@@ -45,18 +45,18 @@ if (NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ".js") @@ -45,18 +45,18 @@ if (NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ".js")
45 endif() 45 endif()
46 # set(CMAKE_EXECUTABLE_SUFFIX ".html") 46 # set(CMAKE_EXECUTABLE_SUFFIX ".html")
47 47
48 -add_executable(sherpa-onnx-wasm-asr-main sherpa-onnx-wasm-asr-main.cc)  
49 -target_link_libraries(sherpa-onnx-wasm-asr-main sherpa-onnx-c-api)  
50 -install(TARGETS sherpa-onnx-wasm-asr-main DESTINATION bin/wasm/asr) 48 +add_executable(sherpa-onnx-wasm-main-asr sherpa-onnx-wasm-main-asr.cc)
  49 +target_link_libraries(sherpa-onnx-wasm-main-asr sherpa-onnx-c-api)
  50 +install(TARGETS sherpa-onnx-wasm-main-asr DESTINATION bin/wasm/asr)
51 51
52 install( 52 install(
53 FILES 53 FILES
54 - "$<TARGET_FILE_DIR:sherpa-onnx-wasm-asr-main>/sherpa-onnx-wasm-asr-main.js" 54 + "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-asr>/sherpa-onnx-wasm-main-asr.js"
55 "index.html" 55 "index.html"
56 - "sherpa-onnx.js"  
57 - "app.js"  
58 - "$<TARGET_FILE_DIR:sherpa-onnx-wasm-asr-main>/sherpa-onnx-wasm-asr-main.wasm"  
59 - "$<TARGET_FILE_DIR:sherpa-onnx-wasm-asr-main>/sherpa-onnx-wasm-asr-main.data" 56 + "sherpa-onnx-asr.js"
  57 + "app-asr.js"
  58 + "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-asr>/sherpa-onnx-wasm-main-asr.wasm"
  59 + "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-asr>/sherpa-onnx-wasm-main-asr.data"
60 DESTINATION 60 DESTINATION
61 bin/wasm/asr 61 bin/wasm/asr
62 ) 62 )
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 <section flex="1" overflow="auto" id="sound-clips"> 36 <section flex="1" overflow="auto" id="sound-clips">
37 </section> 37 </section>
38 38
39 - <script src="sherpa-onnx.js"></script>  
40 - <script src="app.js"></script>  
41 - <script src="sherpa-onnx-wasm-asr-main.js"></script> 39 + <script src="sherpa-onnx-asr.js"></script>
  40 + <script src="app-asr.js"></script>
  41 + <script src="sherpa-onnx-wasm-main-asr.js"></script>
42 </body> 42 </body>
@@ -40,19 +40,18 @@ if (NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ".js") @@ -40,19 +40,18 @@ if (NOT CMAKE_EXECUTABLE_SUFFIX STREQUAL ".js")
40 endif() 40 endif()
41 # set(CMAKE_EXECUTABLE_SUFFIX ".html") 41 # set(CMAKE_EXECUTABLE_SUFFIX ".html")
42 42
43 -add_executable(sherpa-onnx-wasm-main sherpa-onnx-wasm-main.cc)  
44 -target_link_libraries(sherpa-onnx-wasm-main sherpa-onnx-c-api)  
45 -install(TARGETS sherpa-onnx-wasm-main DESTINATION bin/wasm/tts) 43 +add_executable(sherpa-onnx-wasm-main-tts sherpa-onnx-wasm-main-tts.cc)
  44 +target_link_libraries(sherpa-onnx-wasm-main-tts sherpa-onnx-c-api)
  45 +install(TARGETS sherpa-onnx-wasm-main-tts DESTINATION bin/wasm/tts)
46 46
47 install( 47 install(
48 FILES 48 FILES
49 - "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.js" 49 + "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-tts>/sherpa-onnx-wasm-main-tts.js"
50 "index.html" 50 "index.html"
51 - "sherpa-onnx.js"  
52 - "app.js"  
53 - "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.wasm"  
54 - "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.data"  
55 - # "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main>/sherpa-onnx-wasm-main.html" 51 + "sherpa-onnx-tts.js"
  52 + "app-tts.js"
  53 + "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-tts>/sherpa-onnx-wasm-main-tts.wasm"
  54 + "$<TARGET_FILE_DIR:sherpa-onnx-wasm-main-tts>/sherpa-onnx-wasm-main-tts.data"
56 DESTINATION 55 DESTINATION
57 bin/wasm/tts 56 bin/wasm/tts
58 ) 57 )
@@ -40,7 +40,7 @@ @@ -40,7 +40,7 @@
40 <section flex="1" overflow="auto" id="sound-clips"> 40 <section flex="1" overflow="auto" id="sound-clips">
41 </section> 41 </section>
42 42
43 - <script src="app.js"></script>  
44 - <script src="sherpa-onnx.js"></script>  
45 - <script src="sherpa-onnx-wasm-main.js"></script> 43 + <script src="app-tts.js"></script>
  44 + <script src="sherpa-onnx-tts.js"></script>
  45 + <script src="sherpa-onnx-wasm-main-tts.js"></script>
46 </body> 46 </body>