csukuangfj commited on
Commit
7459972
1 Parent(s): e907f73

add alimeeting

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. model.py +26 -4
app.py CHANGED
@@ -29,7 +29,7 @@ import torchaudio
29
 
30
  from model import get_pretrained_model, language_to_models, sample_rate
31
 
32
- languages = sorted(language_to_models.keys())
33
 
34
 
35
  def convert_to_wav(in_filename: str) -> str:
 
29
 
30
  from model import get_pretrained_model, language_to_models, sample_rate
31
 
32
+ languages = list(language_to_models.keys())
33
 
34
 
35
  def convert_to_wav(in_filename: str) -> str:
model.py CHANGED
@@ -183,10 +183,32 @@ def _get_tal_csasr_pre_trained_model(repo_id: str):
183
  )
184
 
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  chinese_models = {
 
187
  "yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-A-2022-07-12": _get_aishell2_pretrained_model, # noqa
188
  "yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-B-2022-07-12": _get_aishell2_pretrained_model, # noqa
189
- "luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2": _get_wenetspeech_pre_trained_model, # noqa
190
  }
191
 
192
  english_models = {
@@ -205,7 +227,7 @@ all_models = {
205
  }
206
 
207
  language_to_models = {
208
- "Chinese": sorted(chinese_models.keys()),
209
- "English": sorted(english_models.keys()),
210
- "Chinese+English": sorted(chinese_english_mixed_models.keys()),
211
  }
 
183
  )
184
 
185
 
186
+ @lru_cache(maxsize=10)
187
+ def _get_alimeeting_pre_trained_model(repo_id: str):
188
+ assert repo_id in [
189
+ "luomingshuang/icefall_asr_alimeeting_pruned_transducer_stateless2",
190
+ ]
191
+
192
+ nn_model_filename = _get_nn_model_filename(
193
+ repo_id=repo_id,
194
+ filename="cpu_jit_torch_1.7.1.pt",
195
+ )
196
+ token_filename = _get_token_filename(repo_id=repo_id)
197
+
198
+ return OfflineAsr(
199
+ nn_model_filename=nn_model_filename,
200
+ bpe_model_filename=None,
201
+ token_filename=token_filename,
202
+ sample_rate=sample_rate,
203
+ device="cpu",
204
+ )
205
+
206
+
207
  chinese_models = {
208
+ "luomingshuang/icefall_asr_wenetspeech_pruned_transducer_stateless2": _get_wenetspeech_pre_trained_model, # noqa
209
  "yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-A-2022-07-12": _get_aishell2_pretrained_model, # noqa
210
  "yuekai/icefall-asr-aishell2-pruned-transducer-stateless5-B-2022-07-12": _get_aishell2_pretrained_model, # noqa
211
+ "luomingshuang/icefall_asr_alimeeting_pruned_transducer_stateless2": _get_alimeeting_pre_trained_model, # noqa
212
  }
213
 
214
  english_models = {
 
227
  }
228
 
229
  language_to_models = {
230
+ "Chinese": list(chinese_models.keys()),
231
+ "English": list(english_models.keys()),
232
+ "Chinese+English": list(chinese_english_mixed_models.keys()),
233
  }