import streamlit as st import streamlit.components.v1 as components # HTML and JavaScript for Speech Recognition using webkitSpeechRecognition speech_recognition_html = """
Speak something...
""" # Streamlit UI st.title("Speech-to-Text Demo") st.write("Click the button below and start speaking. The recognized text will be shown here:") # Display the HTML with the embedded speech recognition components.html(speech_recognition_html, height=200) # Output area where the recognized speech will be displayed output = st.empty() # The Streamlit component listens for the postMessage event and updates the output st.write("Recognized Text:") transcript = st.text_area("Transcript:", "", height=150)