RoleSpecific commited on
Commit
9343aae
1 Parent(s): 99c83b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -30
app.py CHANGED
@@ -162,36 +162,6 @@ def main():
162
  st.sidebar.markdown("<p style='text-align: center;'>Former Professional Kickboxer</p>", unsafe_allow_html=True)
163
  st.sidebar.button('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Clear Chat History &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', on_click=clear_chat_history)
164
 
165
- if "messages" not in st.session_state.keys():
166
- st.session_state.messages = [
167
- {"role": "assistant", "content": "Hi! I'm Elon Musk. Ask me a question"}]
168
-
169
- for message in st.session_state.messages:
170
- with st.chat_message(message["role"]):
171
- st.write(message["content"])
172
-
173
- if prompt := st.chat_input():
174
- st.session_state.messages.append({"role": "user", "content": prompt})
175
- with st.chat_message("user"):
176
- st.write(prompt)
177
-
178
- # Display chat messages and bot response
179
- if st.session_state.messages[-1]["role"] != "assistant":
180
- with st.chat_message("assistant"):
181
- with st.spinner("Thinking..."):
182
- response = user_input(prompt)
183
- placeholder = st.empty()
184
- full_response = response
185
- placeholder.markdown(full_response)
186
- if response is not None:
187
- message = {"role": "assistant", "content": full_response}
188
- st.session_state.messages.append(message)
189
-
190
-
191
- if __name__ == "__main__":
192
- main()
193
-
194
-
195
  if "messages" not in st.session_state.keys():
196
  st.session_state.messages = [
197
  {"role": "assistant", "content": "Hi! I'm Andrew Tate. Ask me a question"}]
 
162
  st.sidebar.markdown("<p style='text-align: center;'>Former Professional Kickboxer</p>", unsafe_allow_html=True)
163
  st.sidebar.button('&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Clear Chat History &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', on_click=clear_chat_history)
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  if "messages" not in st.session_state.keys():
166
  st.session_state.messages = [
167
  {"role": "assistant", "content": "Hi! I'm Andrew Tate. Ask me a question"}]