Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@ import nemo.collections.asr as nemo_asr
|
|
2 |
import gradio as gr
|
3 |
|
4 |
asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(model_name="stt_rw_conformer_ctc_large")
|
|
|
|
|
5 |
|
6 |
def transcribe(file):
|
7 |
|
@@ -10,8 +12,12 @@ def transcribe(file):
|
|
10 |
|
11 |
print("filename: ",file)
|
12 |
transcription= asr_model.transcribe([file])
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
|
16 |
|
17 |
with gr.Blocks() as demo:
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(model_name="stt_rw_conformer_ctc_large")
|
5 |
+
df = pd.read_csv("amasaku_data.tsv",sep='\t')
|
6 |
+
amasaku_mapping = {key.lower():val.lower() for key,val in zip(df.iloc[:,0],df.iloc[:,1])}
|
7 |
|
8 |
def transcribe(file):
|
9 |
|
|
|
12 |
|
13 |
print("filename: ",file)
|
14 |
transcription= asr_model.transcribe([file])
|
15 |
+
transcription = transcription.lower().split()
|
16 |
+
transcribed_with_amasuku = []
|
17 |
+
for word in transcription[0]:
|
18 |
+
transcribed_with_amasuku(amasaku_mapping.get(word,word))
|
19 |
+
transcribed_with_amasuku = " ".join(transcribed_with_amasuku)
|
20 |
+
return transcription_with_amasaku.capitalize()
|
21 |
|
22 |
|
23 |
with gr.Blocks() as demo:
|