ThatOneCoder commited on
Commit
3b5f1fa
·
verified ·
1 Parent(s): 26fbf4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -18
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
- state=st.session_state
 
 
 
 
 
 
 
 
 
5
 
6
- if 'text_received' not in state:
7
- state.text_received=[]
8
-
9
- c1,c2=st.columns(2)
10
- with c1:
11
- st.write("Convert speech to text:")
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
+ }