Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import torchaudio
|
|
3 |
from torchaudio.transforms import Resample
|
4 |
from transformers import Speech2TextProcessor, Speech2TextForConditionalGeneration
|
5 |
import streamlit as st
|
6 |
-
from
|
7 |
|
8 |
def preprocess_audio(audio_bytes, sample_rate=16000):
|
9 |
# Load audio and convert to mono if necessary
|
@@ -37,7 +37,7 @@ def transcribe_audio(audio_bytes):
|
|
37 |
st.title("Audio to Text Transcription with Recording")
|
38 |
|
39 |
# Use the st_audio_recorder widget to record audio
|
40 |
-
audio_bytes =
|
41 |
|
42 |
# Display the recorded audio
|
43 |
if audio_bytes:
|
|
|
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 |
|
8 |
def preprocess_audio(audio_bytes, sample_rate=16000):
|
9 |
# Load audio and convert to mono if necessary
|
|
|
37 |
st.title("Audio to Text Transcription with Recording")
|
38 |
|
39 |
# Use the st_audio_recorder widget to record audio
|
40 |
+
audio_bytes = audio_recorder(sample_rate=16000, codec="wav", show_playback_controls=True)
|
41 |
|
42 |
# Display the recorded audio
|
43 |
if audio_bytes:
|