# voice_component.py import streamlit as st import streamlit.components.v1 as components def voice_input_component(): """ Creates a streamlined voice input component with animations. Returns the transcribed text from voice input. """ # HTML component for voice input with animations voice_html = """
Ask a question
""" # Generate a unique key for the component key = "voice_input" # Initialize session state for voice input if not exists if key not in st.session_state: st.session_state[key] = "" # Render the component components.html(voice_html, height=250) # Return the last transcript return st.session_state.get(key, "")