Spaces:
Runtime error
Runtime error
use soundfile instead of librosa to write files
Browse files- app.py +0 -5
- nemo_asr.py +2 -1
app.py
CHANGED
@@ -8,11 +8,6 @@ from transformers import Wav2Vec2ProcessorWithLM, Wav2Vec2CTCTokenizer, Wav2Vec2
|
|
8 |
|
9 |
from engine import SpeechToTextEngine
|
10 |
import wave
|
11 |
-
import gradio as gr
|
12 |
-
import librosa
|
13 |
-
import soundfile as sf
|
14 |
-
import warnings
|
15 |
-
|
16 |
from nemo_asr import transcribe
|
17 |
|
18 |
|
|
|
8 |
|
9 |
from engine import SpeechToTextEngine
|
10 |
import wave
|
|
|
|
|
|
|
|
|
|
|
11 |
from nemo_asr import transcribe
|
12 |
|
13 |
|
nemo_asr.py
CHANGED
@@ -2,6 +2,7 @@ import aiofiles
|
|
2 |
import nemo
|
3 |
import nemo.collections.asr as nemo_asr
|
4 |
import librosa
|
|
|
5 |
|
6 |
|
7 |
def transcribe(file, modelName="stt_rw_conformer_transducer_large"):
|
@@ -23,7 +24,7 @@ def transcribe(file, modelName="stt_rw_conformer_transducer_large"):
|
|
23 |
# print(f"Audio in {fname} was recognized as: {transcription}")
|
24 |
# print(transcription[0])
|
25 |
x, sr = librosa.load(file.name)
|
26 |
-
|
27 |
transcription= asr_model.transcribe(["Test.wav"])
|
28 |
print(transcription)
|
29 |
return {"text": transcription, "filename": file.name}
|
|
|
2 |
import nemo
|
3 |
import nemo.collections.asr as nemo_asr
|
4 |
import librosa
|
5 |
+
import soundfile as sf
|
6 |
|
7 |
|
8 |
def transcribe(file, modelName="stt_rw_conformer_transducer_large"):
|
|
|
24 |
# print(f"Audio in {fname} was recognized as: {transcription}")
|
25 |
# print(transcription[0])
|
26 |
x, sr = librosa.load(file.name)
|
27 |
+
sf.write("Test.wav", x, sr=16000, norm=False)
|
28 |
transcription= asr_model.transcribe(["Test.wav"])
|
29 |
print(transcription)
|
30 |
return {"text": transcription, "filename": file.name}
|