carlotamdeluna commited on
Commit
83dc93b
1 Parent(s): ef74c67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -20,6 +20,25 @@ if "generated" not in st.session_state:
20
  if "input" not in st.session_state:
21
  st.session_state["input"] = ""
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  # Define function to get user input
24
  def get_text():
25
  """
 
20
  if "input" not in st.session_state:
21
  st.session_state["input"] = ""
22
 
23
+
24
+
25
+
26
+ def new_chat():
27
+ """
28
+ Clears session state and starts a new chat.
29
+ """
30
+ save = []
31
+ for i in range(len(st.session_state['generated'])-1, -1, -1):
32
+ save.append("User:" + st.session_state["past"][i])
33
+ save.append("Bot:" + st.session_state["generated"][i])
34
+ st.session_state["stored_session"].append(save)
35
+ st.session_state["generated"] = ""
36
+ st.session_state["input"] = ""
37
+ st.session_state.entity_memory.entity_store = {}
38
+ st.session_state.entity_memory.buffer.clear()
39
+
40
+
41
+
42
  # Define function to get user input
43
  def get_text():
44
  """