Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,17 @@
|
|
1 |
import torch
|
2 |
-
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
|
|
3 |
import streamlit as st
|
4 |
from audio_recorder_streamlit import audio_recorder
|
5 |
import numpy as np
|
6 |
|
7 |
# Function to transcribe audio to text
|
8 |
def transcribe_audio(audio_bytes):
|
9 |
-
processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-base-960h")
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
# Convert bytes to numpy array
|
13 |
audio_array = np.frombuffer(audio_bytes, dtype=np.int16)
|
|
|
1 |
import torch
|
2 |
+
#from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
3 |
+
from transformers import Speech2Text2Processor, SpeechEncoderDecoderModel
|
4 |
import streamlit as st
|
5 |
from audio_recorder_streamlit import audio_recorder
|
6 |
import numpy as np
|
7 |
|
8 |
# Function to transcribe audio to text
|
9 |
def transcribe_audio(audio_bytes):
|
10 |
+
#processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-base-960h")
|
11 |
+
processor = Speech2Text2Processor.from_pretrained("facebook/s2t-wav2vec2-large-en-de")
|
12 |
+
model = SpeechEncoderDecoderModel.from_pretrained("facebook/s2t-wav2vec2-large-en-de")
|
13 |
+
#model = Wav2Vec2ForCTC.from_pretrained("facebook/wav2vec2-base-960h")
|
14 |
+
|
15 |
|
16 |
# Convert bytes to numpy array
|
17 |
audio_array = np.frombuffer(audio_bytes, dtype=np.int16)
|