Spaces:
Running
Running
Liangcd
commited on
Commit
·
daf1cd2
1
Parent(s):
76ddd3a
[demo] support English
Browse files
app.py
CHANGED
@@ -36,16 +36,17 @@ def recognition(audio, lang='CN'):
|
|
36 |
del decoder
|
37 |
decoder = wenet.Decoder(lang='chs')
|
38 |
cur_lang = 'CN'
|
|
|
39 |
elif lang == 'EN':
|
40 |
if cur_lang != lang:
|
41 |
del decoder
|
42 |
decoder = wenet.Decoder(lang='en')
|
43 |
cur_lang = 'EN'
|
44 |
-
|
45 |
return "ERROR! English is not supported yet!"
|
46 |
else:
|
47 |
return "ERROR! Please select a language!"
|
48 |
-
|
49 |
if ans is None:
|
50 |
return "ERROR! No text output! Please try again!"
|
51 |
# NOTE: ans (json)
|
|
|
36 |
del decoder
|
37 |
decoder = wenet.Decoder(lang='chs')
|
38 |
cur_lang = 'CN'
|
39 |
+
ans = decoder.decode(y.tobytes(), True)
|
40 |
elif lang == 'EN':
|
41 |
if cur_lang != lang:
|
42 |
del decoder
|
43 |
decoder = wenet.Decoder(lang='en')
|
44 |
cur_lang = 'EN'
|
45 |
+
ans = decoder.decode(y.tobytes(), True)
|
46 |
return "ERROR! English is not supported yet!"
|
47 |
else:
|
48 |
return "ERROR! Please select a language!"
|
49 |
+
|
50 |
if ans is None:
|
51 |
return "ERROR! No text output! Please try again!"
|
52 |
# NOTE: ans (json)
|