SaileshSivan commited on
Commit
a56eb5a
·
1 Parent(s): d832a69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -36
app.py CHANGED
@@ -85,39 +85,39 @@ if 'flowmessages' not in st.session_state:
85
  """)
86
 
87
  ]
88
-
89
- # Display conversation history at the top
90
- for message in reversed(st.session_state['flowmessages']):
91
- if isinstance(message, AIMessage):
92
- st.header("Doctor AI", divider=True)
93
- st.write(message.content)
94
- elif isinstance(message, HumanMessage):
95
- st.header(":blue[You]", divider=True)
96
- st.write(message.content)
97
-
98
- # Create an empty space at the bottom
99
- bottom_space = st.empty()
100
-
101
- # Input box and form at the bottom
102
- with st.form(key='my_form', clear_on_submit=True):
103
- input_question = st.text_input("Type here.")
104
- submit = st.form_submit_button("Ask Doctor AI")
105
-
106
- # If the "Submit" button is clicked
107
- if submit:
108
- # Get Doctor AI's response
109
- response = get_chatmodel_response(input_question)
110
-
111
- if response is not None:
112
- # Display conversation history
113
- for message in reversed(st.session_state['flowmessages']):
114
- if isinstance(message, AIMessage):
115
- st.header("Doctor AI", divider=True)
116
- st.write(message.content)
117
- elif isinstance(message, HumanMessage):
118
- st.header(":blue[You]", divider=True)
119
- st.write(message.content)
120
- # Scroll to the bottom to show the latest input
121
- bottom_space.markdown("<br>", unsafe_allow_html=True)
122
- else:
123
- st.subheader("Error: Unable to get response. Please try again later.")
 
85
  """)
86
 
87
  ]
88
+ with st.container():
89
+ # Display conversation history at the top
90
+ for message in reversed(st.session_state["flowmessages"]):
91
+ if isinstance(message, AIMessage):
92
+ st.header("Doctor AI", divider=True)
93
+ st.write(message.content)
94
+ elif isinstance(message, HumanMessage):
95
+ st.header(":blue[You]", divider=True)
96
+ st.write(message.content)
97
+
98
+ # Create an empty space at the bottom
99
+ bottom_space = st.empty()
100
+
101
+ # Input box and form at the bottom
102
+ with st.form(key="my_form", clear_on_submit=True):
103
+ input_question = st.text_input("Type here.")
104
+ submit = st.form_submit_button("Ask Doctor AI")
105
+
106
+ # If the "Submit" button is clicked
107
+ if submit:
108
+ # Get Doctor AI's response
109
+ response = get_chatmodel_response(input_question)
110
+
111
+ if response is not None:
112
+ # Display conversation history
113
+ for message in reversed(st.session_state["flowmessages"]):
114
+ if isinstance(message, AIMessage):
115
+ st.header("Doctor AI", divider=True)
116
+ st.write(message.content)
117
+ elif isinstance(message, HumanMessage):
118
+ st.header(":blue[You]", divider=True)
119
+ st.write(message.content)
120
+ # Scroll to the bottom to show the latest input
121
+ bottom_space.markdown("<br>", unsafe_allow_html=True)
122
+ else:
123
+ st.subheader("Error: Unable to get response. Please try again later.")