Liangcd commited on
Commit
f6f3627
·
1 Parent(s): 471c3db

[demo] support English

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -19,8 +19,8 @@ import wenetruntime as wenet
19
  import librosa
20
 
21
  wenet.set_log_level(2)
22
- # decoder_cn = wenet.Decoder(lang='chs')
23
- decoder_en = wenet.Decoder(lang='en')
24
 
25
 
26
  def recognition(audio, lang='CN'):
@@ -30,9 +30,10 @@ def recognition(audio, lang='CN'):
30
  # NOTE: model supports 16k sample_rate
31
  y = (y * (1 << 15)).astype("int16")
32
  if lang == 'CN':
33
- ans = decoder_en.decode(y.tobytes(), True)
34
  elif lang == 'EN':
35
- ans = decoder_en.decode(y.tobytes(), True)
 
36
  else:
37
  return "ERROR! Please select a language!"
38
  if ans is None:
 
19
  import librosa
20
 
21
  wenet.set_log_level(2)
22
+ decoder_cn = wenet.Decoder(lang='chs')
23
+ # decoder_en = wenet.Decoder(lang='en')
24
 
25
 
26
  def recognition(audio, lang='CN'):
 
30
  # NOTE: model supports 16k sample_rate
31
  y = (y * (1 << 15)).astype("int16")
32
  if lang == 'CN':
33
+ ans = decoder_cn.decode(y.tobytes(), True)
34
  elif lang == 'EN':
35
+ # ans = decoder_en.decode(y.tobytes(), True)
36
+ return "ERROR! English is not supported yet!"
37
  else:
38
  return "ERROR! Please select a language!"
39
  if ans is None: