Spaces:
Running
Running
Update app.py
Browse files
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 |
-
|
15 |
-
<button>Record Audio</button>
|
16 |
<script src="mic_component.js"></script>
|
|
|
|
|
17 |
"""
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
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
|