Spaces:
Running
Running
File size: 602 Bytes
545ec70 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import streamlit as st
from streamlit_webrtc import webrtc_streamer, WebRtcMode, ClientSettings
# Initialize Streamlit app layout
st.title("Microphone Input in Streamlit")
# WebRTC settings
webrtc_ctx = webrtc_streamer(
key="audio-only",
mode=WebRtcMode.SENDONLY,
client_settings=ClientSettings(
media_stream_constraints={
"audio": True,
"video": False
}
)
)
# Placeholder for capturing audio
if webrtc_ctx.state.playing:
st.write("Microphone is active. Speak into the microphone...")
else:
st.write("Click to start microphone input.") |