vakodiya's picture
Create app.py
545ec70 verified
raw
history blame
602 Bytes
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.")