File size: 713 Bytes
261bad5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st


def main():
    st.title("Health Chatbot")
    
    st.set_page_config(page_title="Health Chatbot", page_icon="🧊", layout="wide")
    
    if 'messages' not in st.session_state:
        st.session_state.messages = []
    
    # display all the messages already in the session state
    for message in st.session_state.messages:
        if message["sender"] == "user":
            st.write("You: ", message["message"])
        else:
            st.write("Bot: ", message["message"])
    
    user_input = st.chat_input("You", key="user_input")
    if user_input:
        st.session_state.messages.append({"sender": "user", "message": user_input})


if __name__ == "__main__":
    main()