Kleber commited on
Commit
681b48e
1 Parent(s): 54e1781

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import nemo.collections.asr as nemo_asr
2
  import gradio as gr
3
  import pandas as pd
 
4
 
5
  asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(model_name="stt_rw_conformer_ctc_large")
6
  df = pd.read_csv("amasaku_data.tsv",sep='\t')
@@ -12,8 +13,14 @@ def transcribe(file):
12
  #if not audio:
13
  # return {state_var: state, transcription_var: state}
14
 
15
- print("filename: ",file)
16
- transcription= asr_model.transcribe([file])
 
 
 
 
 
 
17
  transcription = transcription[0].lower().split()
18
  transcribed_with_amasaku = []
19
  for word in transcription:
 
1
  import nemo.collections.asr as nemo_asr
2
  import gradio as gr
3
  import pandas as pd
4
+ from pydub import AudioSegment
5
 
6
  asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(model_name="stt_rw_conformer_ctc_large")
7
  df = pd.read_csv("amasaku_data.tsv",sep='\t')
 
13
  #if not audio:
14
  # return {state_var: state, transcription_var: state}
15
 
16
+ #print("filename: ",file)
17
+ try:
18
+ audio = AudioSegment.from_file(file).set_frame_rate(16000).set_channels(1)
19
+ new_file_name = file.split(".")[0]+".wav"
20
+ audio.export(new_file_name,format)
21
+ except Exception as e:
22
+ print(e)
23
+ transcription= asr_model.transcribe([new_file_name])
24
  transcription = transcription[0].lower().split()
25
  transcribed_with_amasaku = []
26
  for word in transcription: