rutsam commited on
Commit
b263f8c
1 Parent(s): c91f24a

pass file.name

Browse files
Files changed (1) hide show
  1. nemo_asr.py +6 -6
nemo_asr.py CHANGED
@@ -4,10 +4,10 @@ import nemo.collections.asr as nemo_asr
4
 
5
 
6
  def transcribe(file, modelName="stt_rw_conformer_transducer_large"):
7
- with open(file.name, 'wb') as out_file:
8
- #out_file = file.read() # async read
9
- content = file.read()
10
- out_file.write(content)
11
  #out_file.write(content) # async write
12
  #print(out_file.name)
13
  asr_model = nemo_asr.models.EncDecRNNTBPEModel.from_pretrained(
@@ -21,6 +21,6 @@ def transcribe(file, modelName="stt_rw_conformer_transducer_large"):
21
  # for fname, transcription in zip(files, asr_model.transcribe(paths2audio_files=files)):
22
  # print(f"Audio in {fname} was recognized as: {transcription}")
23
  # print(transcription[0])
24
- transcription= asr_model.transcribe([out_file.name])
25
  print(transcription)
26
- return {"text": transcription, "filename": out_file.name}
 
4
 
5
 
6
  def transcribe(file, modelName="stt_rw_conformer_transducer_large"):
7
+ # with open(file.name, 'wb') as out_file:
8
+ # #out_file = file.read() # async read
9
+ # content = file.read()
10
+ # out_file.write(content)
11
  #out_file.write(content) # async write
12
  #print(out_file.name)
13
  asr_model = nemo_asr.models.EncDecRNNTBPEModel.from_pretrained(
 
21
  # for fname, transcription in zip(files, asr_model.transcribe(paths2audio_files=files)):
22
  # print(f"Audio in {fname} was recognized as: {transcription}")
23
  # print(transcription[0])
24
+ transcription= asr_model.transcribe([file.name])
25
  print(transcription)
26
+ return {"text": transcription, "filename": file.name}