Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,17 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import Wav2Vec2BertForCTC, pipeline
|
3 |
-
from m4t_processor_with_lm import M4TProcessorWithLM
|
4 |
|
5 |
# Load the Punjabi ASR model
|
6 |
model_id = 'kdcyberdude/w2v-bert-punjabi'
|
7 |
-
processor =
|
8 |
model = Wav2Vec2BertForCTC.from_pretrained(model_id)
|
9 |
|
|
|
10 |
pipe = pipeline('automatic-speech-recognition',
|
11 |
model=model,
|
12 |
-
tokenizer=processor
|
13 |
-
feature_extractor=processor.feature_extractor,
|
14 |
-
decoder=processor.decoder,
|
15 |
return_timestamps='word')
|
16 |
|
17 |
def transcribe_audio(audio_file):
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import Wav2Vec2BertForCTC, AutoProcessor, pipeline
|
|
|
3 |
|
4 |
# Load the Punjabi ASR model
|
5 |
model_id = 'kdcyberdude/w2v-bert-punjabi'
|
6 |
+
processor = AutoProcessor.from_pretrained(model_id)
|
7 |
model = Wav2Vec2BertForCTC.from_pretrained(model_id)
|
8 |
|
9 |
+
# Set up the pipeline
|
10 |
pipe = pipeline('automatic-speech-recognition',
|
11 |
model=model,
|
12 |
+
tokenizer=processor,
|
|
|
|
|
13 |
return_timestamps='word')
|
14 |
|
15 |
def transcribe_audio(audio_file):
|