| import os | |
| import streamlit as st | |
| from streamlit_chat_widget import chat_input_widget | |
| def app(): | |
| st.title("Doctor AI Assistant") | |
| if "chat_history" not in st.session_state: | |
| st.session_state.chat_history = [ | |
| "Hello! I am your Doctor AI Assistant. How can I help you?" | |
| ] | |
| # Display chat history | |
| for message in st.session_state.chat_history: | |
| st.write(message) | |
| # Display the chat input widget at the bottom | |
| user_input = chat_input_widget() | |
| if user_input: | |
| if "text" in user_input: | |
| user_text =user_input["text"] | |
| st.session_state.chat_history.append(f"You: {user_text}") | |
| elif "audioFile" in user_input: | |
| audio_bytes = bytes(user_input["audioFile"]) | |
| st.audio(audio_bytes) | |
| if __name__ == "__main__": | |
| app() |