Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -50,12 +50,18 @@ import torch
|
|
50 |
import streamlit as st
|
51 |
from audio_recorder_streamlit import audio_recorder
|
52 |
import numpy as np
|
53 |
-
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
|
|
|
|
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
model = AutoModelForSpeechSeq2Seq.from_pretrained("facebook/s2t-small-librispeech-asr")
|
58 |
|
|
|
|
|
|
|
|
|
|
|
59 |
# Convert audio bytes to numpy array
|
60 |
audio_array = np.frombuffer(audio_bytes, dtype=np.int16)
|
61 |
|
|
|
50 |
import streamlit as st
|
51 |
from audio_recorder_streamlit import audio_recorder
|
52 |
import numpy as np
|
53 |
+
#from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
|
54 |
+
# Load model directly
|
55 |
+
from transformers import AutoProcessor, AutoModelForPreTraining
|
56 |
|
57 |
+
processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base")
|
58 |
+
model = AutoModelForPreTraining.from_pretrained("facebook/wav2vec2-base")
|
|
|
59 |
|
60 |
+
def transcribe_audio(audio_bytes):
|
61 |
+
# processor = AutoProcessor.from_pretrained("facebook/s2t-small-librispeech-asr")
|
62 |
+
# model = AutoModelForSpeechSeq2Seq.from_pretrained("facebook/s2t-small-librispeech-asr")
|
63 |
+
processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base")
|
64 |
+
model = AutoModelForPreTraining.from_pretrained("facebook/wav2vec2-base")
|
65 |
# Convert audio bytes to numpy array
|
66 |
audio_array = np.frombuffer(audio_bytes, dtype=np.int16)
|
67 |
|