CCockrum commited on
Commit
e7b8136
·
verified ·
1 Parent(s): 3396b0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -141,7 +141,7 @@ for message in st.session_state.chat_history:
141
  if message["role"] == "user":
142
  st.markdown(f"<div class='user-msg'><strong>You:</strong> {message['content']}</div>", unsafe_allow_html=True)
143
  else:
144
- st.markdown(f"<div class='assistant-msg'><strong>Bot:</strong> {message['content']}</div>", unsafe_allow_html=True)
145
 
146
  st.markdown("</div>", unsafe_allow_html=True)
147
 
@@ -157,15 +157,27 @@ if st.button("Send"):
157
  )
158
 
159
  # Display response
160
- st.markdown(f"<div class='assistant-msg'><strong>Bot:</strong> {response}</div>", unsafe_allow_html=True)
161
 
162
  # Display NASA image if available
163
  if image_url:
164
  st.image(image_url, caption="NASA Image of the Day")
165
 
166
- # Follow-up question suggestions
167
- follow_up_options = [follow_up, "Explain differently", "Give me an example"]
168
- selected_option = st.radio("What would you like to do next?", follow_up_options)
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
  if st.button("Continue"):
171
  if selected_option:
@@ -174,4 +186,4 @@ if st.button("Send"):
174
  user_text=selected_option,
175
  chat_history=st.session_state.chat_history
176
  )
177
- st.markdown(f"<div class='assistant-msg'><strong>Bot:</strong> {response}</div>", unsafe_allow_html=True)
 
141
  if message["role"] == "user":
142
  st.markdown(f"<div class='user-msg'><strong>You:</strong> {message['content']}</div>", unsafe_allow_html=True)
143
  else:
144
+ st.markdown(f"<div class='assistant-msg'><strong>HAL:</strong> {message['content']}</div>", unsafe_allow_html=True)
145
 
146
  st.markdown("</div>", unsafe_allow_html=True)
147
 
 
157
  )
158
 
159
  # Display response
160
+ st.markdown(f"<div class='assistant-msg'><strong>HAL:</strong> {response}</div>", unsafe_allow_html=True)
161
 
162
  # Display NASA image if available
163
  if image_url:
164
  st.image(image_url, caption="NASA Image of the Day")
165
 
166
+ # Display a conversational follow-up message
167
+ st.markdown(f"<div class='assistant-msg'><strong>HAL:</strong> {follow_up}</div>", unsafe_allow_html=True)
168
+
169
+ # Provide a text box for the user's next response
170
+ next_input = st.text_input("HAL is waiting for your response...")
171
+
172
+ # If the user enters a follow-up message
173
+ if next_input:
174
+ response, _, st.session_state.chat_history, _ = get_response(
175
+ system_message="You are a helpful AI assistant.",
176
+ user_text=next_input,
177
+ chat_history=st.session_state.chat_history
178
+ )
179
+ st.markdown(f"<div class='assistant-msg'><strong>HAL:</strong> {response}</div>", unsafe_allow_html=True)
180
+
181
 
182
  if st.button("Continue"):
183
  if selected_option:
 
186
  user_text=selected_option,
187
  chat_history=st.session_state.chat_history
188
  )
189
+ st.markdown(f"<div class='assistant-msg'><strong>HAL:</strong> {response}</div>", unsafe_allow_html=True)