vakodiya commited on
Commit
aca81e0
1 Parent(s): 7ba16e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -11,12 +11,18 @@ import streamlit.components.v1 as components
11
  st.title("Microphone Input in Streamlit")
12
 
13
  # Load the custom component
14
- mic_component = """
15
- <button>Record Audio</button>
16
  <script src="mic_component.js"></script>
 
 
17
  """
18
 
19
- components.html(mic_component)
 
 
 
 
 
20
 
21
  def audio_callback(frame):
22
  # Get raw audio data from the frame
 
11
  st.title("Microphone Input in Streamlit")
12
 
13
  # Load the custom component
14
+ audio_recorder_html = """
 
15
  <script src="mic_component.js"></script>
16
+ <button id="recordButton">Start Recording</button>
17
+ <button id="stopButton">Stop Recording</button>
18
  """
19
 
20
+ # Embed the JavaScript and HTML in Streamlit
21
+ components.html(audio_recorder_html, height=200)
22
+
23
+ # Retrieve the audio data from the component (if available)
24
+ audio_data = st.experimental_get_query_params().get("value")
25
+
26
 
27
  def audio_callback(frame):
28
  # Get raw audio data from the frame