Spaces:
Sleeping
Sleeping
Commit
•
e30aa42
1
Parent(s):
7388e28
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,20 @@ def get_text():
|
|
22 |
input_text = st.text_input("You: ", st.session_state["input"], key = "input", placeholder = "Your AI Assistant here.. Ask me anything!", label_visibility = "hidden" )
|
23 |
return input_text
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
st.title("Memory Bot")
|
26 |
|
27 |
api = st.sidebar.text_input("API-key", type = "password")
|
@@ -52,7 +66,9 @@ if api:
|
|
52 |
)
|
53 |
|
54 |
else:
|
55 |
-
st.error("No API found!")
|
|
|
|
|
56 |
|
57 |
user_input = get_text()
|
58 |
|
|
|
22 |
input_text = st.text_input("You: ", st.session_state["input"], key = "input", placeholder = "Your AI Assistant here.. Ask me anything!", label_visibility = "hidden" )
|
23 |
return input_text
|
24 |
|
25 |
+
def new_chat():
|
26 |
+
save = []
|
27 |
+
for i in range(len(st.session_state["generated"])-1,-1,-1):
|
28 |
+
save.append("User:" + st.session_state["past"][i])
|
29 |
+
save.append("Bot:" + st.session_state["generated"][i])
|
30 |
+
st.session_state["started_session"].append(save)
|
31 |
+
st.session_state["generated"] = []
|
32 |
+
st.session_state["past"] = []
|
33 |
+
st.session_state["input"] = ""
|
34 |
+
st.session_state.entity_memory.store = {}
|
35 |
+
st.session_state.entity_memory.buffer.clear()
|
36 |
+
|
37 |
+
|
38 |
+
|
39 |
st.title("Memory Bot")
|
40 |
|
41 |
api = st.sidebar.text_input("API-key", type = "password")
|
|
|
66 |
)
|
67 |
|
68 |
else:
|
69 |
+
st.error("No API key found!")
|
70 |
+
|
71 |
+
st.sidebar.button("New Chat", on_click = new_chat, type = "primary" )
|
72 |
|
73 |
user_input = get_text()
|
74 |
|