Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
|
3 |
import torch
|
4 |
import soundfile as sf
|
5 |
|
6 |
-
#
|
7 |
processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-large-xlsr-53")
|
8 |
model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-large-xlsr-53")
|
9 |
|
@@ -15,7 +15,7 @@ def transcribe_audio(audio):
|
|
15 |
# Read the audio file
|
16 |
audio_input, _ = sf.read(audio.name)
|
17 |
|
18 |
-
# Process audio input
|
19 |
input_values = processor(audio_input, return_tensors="pt").input_values
|
20 |
|
21 |
# Get model logits (raw prediction)
|
@@ -36,3 +36,4 @@ iface = gr.Interface(fn=transcribe_audio,
|
|
36 |
|
37 |
iface.launch()
|
38 |
|
|
|
|
3 |
import torch
|
4 |
import soundfile as sf
|
5 |
|
6 |
+
# Correctly load the Wav2Vec2Processor and model
|
7 |
processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-large-xlsr-53")
|
8 |
model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-large-xlsr-53")
|
9 |
|
|
|
15 |
# Read the audio file
|
16 |
audio_input, _ = sf.read(audio.name)
|
17 |
|
18 |
+
# Process audio input using the processor
|
19 |
input_values = processor(audio_input, return_tensors="pt").input_values
|
20 |
|
21 |
# Get model logits (raw prediction)
|
|
|
36 |
|
37 |
iface.launch()
|
38 |
|
39 |
+
|