Spaces:
Runtime error
Runtime error
pass file.name
Browse files- 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 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
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([
|
25 |
print(transcription)
|
26 |
-
return {"text": transcription, "filename":
|
|
|
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}
|