Spaces:
Sleeping
Sleeping
File size: 1,389 Bytes
57d0b95 5a25d9b 1065cb1 5a25d9b 1065cb1 5a25d9b a754c9d 5a25d9b 1065cb1 5a25d9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import streamlit as st
def main():
st.title("Doctor Chatbot")
# Initialize chat history if not already initialized
if "chat_messages" not in st.session_state:
st.session_state.chat_messages = []
# Display chat history
for message in st.session_state.chat_messages:
if message["role"] == "user":
st.text_area("User:", message["content"], height=40, key=message["content"], disabled=True)
else:
st.text_area("AI:", message["content"], height=40, key=message["content"], disabled=True)
# User input
if prompt := st.chat_input("Welcome - How can I help you?"):
# Display user's message in chat message container
with st.chat_message("user"):
st.markdown(prompt)
# Add user message to chat history
st.session_state.chat_messages.append({"role": "user", "content": prompt})
# Get AI response using responsr function
response = "responsr(prompt)"
# Display assistant's response in chat message container
with st.chat_message("assistant"):
st.markdown(response)
# Add assistant's response and audio to chat history
st.session_state.chat_messages.append({
"role": "assistant",
"content": response,
})
if __name__ == "__main__":
main() |