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