Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,19 @@ import io
|
|
5 |
import wave
|
6 |
import requests
|
7 |
from audio_to_text import audio_to_text
|
8 |
-
|
9 |
|
10 |
# Initialize Streamlit app layout
|
11 |
st.title("Microphone Input in Streamlit")
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
def audio_callback(frame):
|
14 |
# Get raw audio data from the frame
|
15 |
audio_data = frame.to_ndarray().astype(np.int16)
|
|
|
5 |
import wave
|
6 |
import requests
|
7 |
from audio_to_text import audio_to_text
|
8 |
+
import streamlit.components.v1 as components
|
9 |
|
10 |
# Initialize Streamlit app layout
|
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
|
23 |
audio_data = frame.to_ndarray().astype(np.int16)
|