BenBranyon commited on
Commit
d6cfa8c
1 Parent(s): 1ea2d65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -26,6 +26,16 @@ def query(payload):
26
  return response
27
 
28
  messages = st.container()
 
 
 
 
 
 
 
 
 
 
29
  message = st.chat_message("assistant").write("Hello human")
30
  if prompt := st.chat_input("Subject of the song"):
31
  messages.chat_message("user").write(prompt)
 
26
  return response
27
 
28
  messages = st.container()
29
+
30
+ # Initialize chat history
31
+ if "messages" not in st.session_state:
32
+ st.session_state.messages = []
33
+
34
+ # Display chat messages from history on app rerun
35
+ for message in st.session_state.messages:
36
+ with st.chat_message(message["role"]):
37
+ st.markdown(message["content"])
38
+
39
  message = st.chat_message("assistant").write("Hello human")
40
  if prompt := st.chat_input("Subject of the song"):
41
  messages.chat_message("user").write(prompt)