KeshavRa commited on
Commit
b3a9001
·
verified ·
1 Parent(s): 8b098f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -166,7 +166,6 @@ if "messages" not in st.session_state:
166
  st.session_state.messages = []
167
 
168
  if "curr_domain" not in st.session_state:
169
- print('non exists')
170
  st.session_state.curr_domain = ""
171
 
172
  init_messages = {
@@ -228,24 +227,21 @@ init_messages = {
228
  }
229
 
230
  # Embed and store the first N supports for this demo
231
- with st.spinner("Loading, please be patient with us ... 🙏"):
232
- L = len(dataset["train"]["questions"])
233
- collection.add(
234
- ids=[str(i) for i in range(0, L)], # IDs are just strings
235
- documents=dataset["train"]["questions"], # Enter questions here
236
- metadatas=[{"type": "support"} for _ in range(0, L)],
237
- )
238
- # db=collection
239
-
240
- print(st.session_state.curr_domain)
241
- print(domain)
242
-
243
- if st.session_state.curr_domain != domain:
244
- print("True")
245
  st.session_state.messages = []
 
246
  init_message = init_messages[domain]
247
  st.session_state.messages.append({"role": "assistant", "content": init_message})
248
- print('changing')
249
  st.session_state.curr_domain = domain
250
 
251
  # Display chat messages from history on app rerun
 
166
  st.session_state.messages = []
167
 
168
  if "curr_domain" not in st.session_state:
 
169
  st.session_state.curr_domain = ""
170
 
171
  init_messages = {
 
227
  }
228
 
229
  # Embed and store the first N supports for this demo
230
+ if st.session_state.curr_domain != domain:
231
+ with st.spinner("Loading, please be patient with us ... 🙏"):
232
+ L = len(dataset["train"]["questions"])
233
+
234
+ collection.add(
235
+ ids=[str(i) for i in range(0, L)], # IDs are just strings
236
+ documents=dataset["train"]["questions"], # Enter questions here
237
+ metadatas=[{"type": "support"} for _ in range(0, L)],
238
+ )
239
+
 
 
 
 
240
  st.session_state.messages = []
241
+
242
  init_message = init_messages[domain]
243
  st.session_state.messages.append({"role": "assistant", "content": init_message})
244
+
245
  st.session_state.curr_domain = domain
246
 
247
  # Display chat messages from history on app rerun