Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import torch
|
2 |
import torchaudio
|
3 |
from torchaudio.transforms import Resample
|
4 |
-
from transformers import
|
5 |
import streamlit as st
|
6 |
from audio_recorder_streamlit import audio_recorder
|
7 |
|
@@ -19,14 +19,9 @@ def preprocess_audio(audio_bytes, sample_rate=16000):
|
|
19 |
return waveform
|
20 |
|
21 |
def transcribe_audio(audio_bytes):
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
processor = Speech2Text2Processor.from_pretrained("facebook/s2t-wav2vec2-large-en-de")
|
26 |
-
|
27 |
-
# Load model directly
|
28 |
-
#processor = AutoProcessor.from_pretrained("facebook/wav2vec2-large-100k-voxpopuli")
|
29 |
-
#model = AutoModelForPreTraining.from_pretrained("facebook/wav2vec2-large-100k-voxpopuli")
|
30 |
# Preprocess audio
|
31 |
input_features = preprocess_audio(audio_bytes)
|
32 |
|
|
|
1 |
import torch
|
2 |
import torchaudio
|
3 |
from torchaudio.transforms import Resample
|
4 |
+
from transformers import Speech2TextProcessor, Speech2TextForConditionalGeneration
|
5 |
import streamlit as st
|
6 |
from audio_recorder_streamlit import audio_recorder
|
7 |
|
|
|
19 |
return waveform
|
20 |
|
21 |
def transcribe_audio(audio_bytes):
|
22 |
+
model = Speech2TextForConditionalGeneration.from_pretrained("facebook/s2t-small-librispeech-asr")
|
23 |
+
processor = Speech2TextProcessor.from_pretrained("facebook/s2t-small-librispeech-asr")
|
24 |
+
|
|
|
|
|
|
|
|
|
|
|
25 |
# Preprocess audio
|
26 |
input_features = preprocess_audio(audio_bytes)
|
27 |
|