Spaces:
Runtime error
Runtime error
ktangri
commited on
Commit
·
ea52814
1
Parent(s):
bc3506a
Add LM-boosted decoding
Browse files
app.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
from librosa import load, resample
|
4 |
|
5 |
|
6 |
asr_model = 'facebook/wav2vec2-base-960h'
|
7 |
-
|
8 |
-
asr = pipeline('automatic-speech-recognition', model=asr_model, feature_extractor=
|
9 |
|
10 |
def transcribe(filepath):
|
11 |
speech, sampling_rate = load(filepath)
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline, Wav2Vec2ProcessorWithLM
|
3 |
from librosa import load, resample
|
4 |
|
5 |
|
6 |
asr_model = 'facebook/wav2vec2-base-960h'
|
7 |
+
processor = Wav2Vec2ProcessorWithLM.from_pretrained(asr_model)
|
8 |
+
asr = pipeline('automatic-speech-recognition', model=asr_model, tokenizer=processor.tokenizer, feature_extractor=processor.feature_extractor, decoder=processor.decoder)
|
9 |
|
10 |
def transcribe(filepath):
|
11 |
speech, sampling_rate = load(filepath)
|