Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,15 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from streamlit_mic_recorder import mic_recorder,speech_to_text
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
start_prompt="Start recording",
|
| 6 |
stop_prompt="Stop recording",
|
| 7 |
just_once=False,
|
|
@@ -10,18 +18,4 @@ audio=mic_recorder(
|
|
| 10 |
args=(),
|
| 11 |
kwargs={},
|
| 12 |
key=None
|
| 13 |
-
)
|
| 14 |
-
|
| 15 |
-
def callback():
|
| 16 |
-
if st.session_state.my_recorder_output:
|
| 17 |
-
audio_bytes=st.session_state.my_recorder_output['bytes']
|
| 18 |
-
st.audio(audio_bytes)
|
| 19 |
-
|
| 20 |
-
mic_recorder(key='my_recorder', callback=callback)
|
| 21 |
-
|
| 22 |
-
{
|
| 23 |
-
"bytes":audio_bytes, # wav audio bytes mono signal, can be processed directly by st.audio
|
| 24 |
-
"sample_rate":sample_rate, # depends on your browser's audio configuration
|
| 25 |
-
"sample_width":sample_width, # 2
|
| 26 |
-
"id": id # A unique timestamp identifier of the audio
|
| 27 |
-
}
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from streamlit_mic_recorder import mic_recorder,speech_to_text
|
| 3 |
|
| 4 |
+
def callback()
|
| 5 |
+
if st.session_state.my_recorder_output:
|
| 6 |
+
audio_bytes=st.session_state.my_recorder_output['bytes']
|
| 7 |
+
st.audio(audio_bytes)
|
| 8 |
+
|
| 9 |
+
mic_recorder(key='my_recorder', callback=callback)
|
| 10 |
+
|
| 11 |
+
text=speech_to_text(
|
| 12 |
+
language='en',
|
| 13 |
start_prompt="Start recording",
|
| 14 |
stop_prompt="Stop recording",
|
| 15 |
just_once=False,
|
|
|
|
| 18 |
args=(),
|
| 19 |
kwargs={},
|
| 20 |
key=None
|
| 21 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|