Hi guys at streamlit community ,
I have been recently developing a chat application with streamlit it has two user inputs one audio recorder and chat input text as in the attached image I want to hide the recoder as the user starts typing text in the chat input widget and appears again after the text is sent very much like the whatsapp application
here is python code :
user_query = None
# Create a chat input field
user_input = st.chat_input("Type your message here...")
with footer_container:
transcript = None
audio_bytes = audio_recorder(text=None, icon_size="5X")
if audio_bytes:
# Write the audio bytes to a file
with st.spinner("Transcribing..."):
webm_file_path = "temp_audio.mp3"
with open(webm_file_path, "wb") as f:
f.write(audio_bytes)
transcript = speech_to_text(webm_file_path)
os.remove(webm_file_path)
user_query = transcript
if user_input is not None and user_input != "":
user_query = user_input