Spaces:
Runtime error
Runtime error
jaekookang
commited on
Commit
•
887f6b2
1
Parent(s):
0ac130c
update examples
Browse files- examples/001_AE_I_DONT_KNOW_MS_BROWN.wav +0 -0
- examples/001_JE_I_DONT_KNOW_MS_BROWN.wav +0 -0
- examples/002_AE_SHE_DOESNT_KNOW_ENGLISH_PRACTICALLY.wav +0 -0
- examples/002_JE_SHE_DOESNT_KNOW_ENGLISH_PRACTICALLY.wav +0 -0
- examples/003_AE_THATS_FROM_MY_BROTHER_WHO_LIVES_IN LONDON.wav +0 -0
- examples/003_JE_THATS_FROM_MY_BROTHER_WHO_LIVES_IN LONDON.wav +0 -0
- examples/004_AE_DID_YOU_STUDY_NELSON.wav +0 -0
- examples/004_JE_DID_YOU_STUDY_NELSON.wav +0 -0
- examples/005_AE_I_DON'T_KNOW_HIM_PERSONALLY.wav +0 -0
- examples/005_JE_I_DON'T_KNOW_HIM_PERSONALLY.wav +0 -0
- examples/006_AE_THE_LITTLE_GIRL_BEHAVED_NATURALLY.wav +0 -0
- examples/006_JE_THE_LITTLE_GIRL_BEHAVED_NATURALLY.wav +0 -0
- examples/007_AE_HOW_LONG_HAVE_YOU_BEEN_WAITING.wav +0 -0
- examples/007_JE_HOW_LONG_HAVE_YOU_BEEN_WAITING.wav +0 -0
- examples/008_AE_COULD_I_HAVE_MY_DRINK_NOW_PLEASE.wav +0 -0
- examples/008_JE_COULD_I_HAVE_MY_DRINK_NOW_PLEASE.wav +0 -0
- examples/009_AE_THE_SUPERINTENDENT_SAYS_THE_TEACHER_IS_A_FOOL.wav +0 -0
- examples/009_JE_THE_SUPERINTENDENT_SAYS_THE_TEACHER_IS_A_FOOL.wav +0 -0
- examples/010_AE_THE_PLAY_ENDED_HAPPILY.wav +0 -0
- examples/010_JE_THE_PLAY_ENDED_HAPPILY.wav +0 -0
- gradio_asr_en_libri100_word_vs_bpe.py +4 -3
- test.py +12 -0
examples/001_AE_I_DONT_KNOW_MS_BROWN.wav
ADDED
Binary file (44.5 kB). View file
|
|
examples/001_JE_I_DONT_KNOW_MS_BROWN.wav
ADDED
Binary file (76.8 kB). View file
|
|
examples/002_AE_SHE_DOESNT_KNOW_ENGLISH_PRACTICALLY.wav
ADDED
Binary file (67.7 kB). View file
|
|
examples/002_JE_SHE_DOESNT_KNOW_ENGLISH_PRACTICALLY.wav
ADDED
Binary file (85.5 kB). View file
|
|
examples/003_AE_THATS_FROM_MY_BROTHER_WHO_LIVES_IN LONDON.wav
ADDED
Binary file (70.3 kB). View file
|
|
examples/003_JE_THATS_FROM_MY_BROTHER_WHO_LIVES_IN LONDON.wav
ADDED
Binary file (115 kB). View file
|
|
examples/004_AE_DID_YOU_STUDY_NELSON.wav
ADDED
Binary file (53.2 kB). View file
|
|
examples/004_JE_DID_YOU_STUDY_NELSON.wav
ADDED
Binary file (59.5 kB). View file
|
|
examples/005_AE_I_DON'T_KNOW_HIM_PERSONALLY.wav
ADDED
Binary file (62.4 kB). View file
|
|
examples/005_JE_I_DON'T_KNOW_HIM_PERSONALLY.wav
ADDED
Binary file (71.4 kB). View file
|
|
examples/006_AE_THE_LITTLE_GIRL_BEHAVED_NATURALLY.wav
ADDED
Binary file (78 kB). View file
|
|
examples/006_JE_THE_LITTLE_GIRL_BEHAVED_NATURALLY.wav
ADDED
Binary file (82.3 kB). View file
|
|
examples/007_AE_HOW_LONG_HAVE_YOU_BEEN_WAITING.wav
ADDED
Binary file (55.4 kB). View file
|
|
examples/007_JE_HOW_LONG_HAVE_YOU_BEEN_WAITING.wav
ADDED
Binary file (96.1 kB). View file
|
|
examples/008_AE_COULD_I_HAVE_MY_DRINK_NOW_PLEASE.wav
ADDED
Binary file (71.7 kB). View file
|
|
examples/008_JE_COULD_I_HAVE_MY_DRINK_NOW_PLEASE.wav
ADDED
Binary file (74 kB). View file
|
|
examples/009_AE_THE_SUPERINTENDENT_SAYS_THE_TEACHER_IS_A_FOOL.wav
ADDED
Binary file (98.3 kB). View file
|
|
examples/009_JE_THE_SUPERINTENDENT_SAYS_THE_TEACHER_IS_A_FOOL.wav
ADDED
Binary file (108 kB). View file
|
|
examples/010_AE_THE_PLAY_ENDED_HAPPILY.wav
ADDED
Binary file (55.4 kB). View file
|
|
examples/010_JE_THE_PLAY_ENDED_HAPPILY.wav
ADDED
Binary file (68.3 kB). View file
|
|
gradio_asr_en_libri100_word_vs_bpe.py
CHANGED
@@ -48,10 +48,11 @@ def predict(wav_file):
|
|
48 |
B = model_bpe(speech)[0]
|
49 |
word_decoded = W[0]
|
50 |
bpe_decoded = B[0]
|
51 |
-
comparison = ''.join(list(d.compare([word_decoded+'\n'], [bpe_decoded+'\n'])))
|
52 |
|
53 |
logger.info('predicted')
|
54 |
-
return word_decoded, bpe_decoded, comparison
|
|
|
55 |
|
56 |
iface = gr.Interface(
|
57 |
predict,
|
@@ -63,7 +64,7 @@ iface = gr.Interface(
|
|
63 |
outputs=[
|
64 |
gr.outputs.Textbox(label='Decoding result (word-token model)'),
|
65 |
gr.outputs.Textbox(label='Decoding result (BPE-token model)'),
|
66 |
-
gr.outputs.Textbox(label='Comparison'),
|
67 |
],
|
68 |
examples=examples,
|
69 |
# article='<p style="text-align:center">Model URL<a target="_blank" href="https://huggingface.co/jkang/espnet2_librispeech_100_conformer">🤗</a></p>',
|
|
|
48 |
B = model_bpe(speech)[0]
|
49 |
word_decoded = W[0]
|
50 |
bpe_decoded = B[0]
|
51 |
+
# comparison = ''.join(list(d.compare([word_decoded+'\n'], [bpe_decoded+'\n'])))
|
52 |
|
53 |
logger.info('predicted')
|
54 |
+
# return word_decoded, bpe_decoded, comparison
|
55 |
+
return word_decoded, bpe_decoded
|
56 |
|
57 |
iface = gr.Interface(
|
58 |
predict,
|
|
|
64 |
outputs=[
|
65 |
gr.outputs.Textbox(label='Decoding result (word-token model)'),
|
66 |
gr.outputs.Textbox(label='Decoding result (BPE-token model)'),
|
67 |
+
# gr.outputs.Textbox(label='Comparison'),
|
68 |
],
|
69 |
examples=examples,
|
70 |
# article='<p style="text-align:center">Model URL<a target="_blank" href="https://huggingface.co/jkang/espnet2_librispeech_100_conformer">🤗</a></p>',
|
test.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def best_overlap(a, b):
|
2 |
+
return max([(score(a[offset:], b), offset) for offset in range(len(a))], key=lambda x: x[0])[1]
|
3 |
+
|
4 |
+
def score(a, b):
|
5 |
+
return sum([a[i] == b[i] for i in range(len(a))])
|
6 |
+
|
7 |
+
a = 'abcde'
|
8 |
+
b = 'abbde'
|
9 |
+
|
10 |
+
print(best_overlap(a, b))
|
11 |
+
print(a + '-' * best_overlap(a, b))
|
12 |
+
print('-' * best_overlap(a, b) + b)
|