Yew Chong commited on
Commit
4d990d2
1 Parent(s): 8dd7b5f

update streamlit app

Browse files
Files changed (1) hide show
  1. streamlit/app8.py +13 -7
streamlit/app8.py CHANGED
@@ -79,7 +79,7 @@ llm_gpt4 = st.session_state.llm_gpt4
79
  ## ------------------------------------------------------------------------------------------------
80
  ## Patient part
81
 
82
- index_name = "indexes/ChestPainQA"
83
 
84
  if "store" not in st.session_state:
85
  st.session_state.store = db.get_store(index_name, embeddings=embeddings)
@@ -150,7 +150,7 @@ sp_mapper = {"human":"student","ai":"patient"}
150
  ## ------------------------------------------------------------------------------------------------
151
  ## ------------------------------------------------------------------------------------------------
152
  ## Grader part
153
- index_name = "indexes/ChestPainRubrics"
154
 
155
  # store = FAISS.load_local(index_name, embeddings)
156
 
@@ -263,7 +263,13 @@ chain2 = st.session_state.chain2
263
  # client = OpenAI(api_key=key)
264
 
265
  st.title("UAT for PatientLLM and GraderLLM")
266
- st.title("Chest pain for now")
 
 
 
 
 
 
267
 
268
  ## Testing HTML
269
  # html_string = """
@@ -298,11 +304,10 @@ st.title("Chest pain for now")
298
 
299
  st.write("Timer has been removed, switch with this button")
300
 
301
- st.write("Buggy button, please double click")
302
- if st.button(f"Switch to {'PATIENT' if st.session_state.active_chat==2 else 'GRADER'}"):
303
  st.session_state.active_chat = 3 - st.session_state.active_chat
304
 
305
- st.write(st.session_state.active_chat)
306
 
307
  # Create two columns for the two chat interfaces
308
  col1, col2 = st.columns(2)
@@ -316,8 +321,9 @@ with col1:
316
 
317
  # Second chat interface
318
  with col2:
319
- st.write("pls dun spam this, its tons of tokens cos chat history")
320
  st.subheader("Grader LLM")
 
321
  for message in st.session_state.messages_2:
322
  with st.chat_message(message["role"]):
323
  st.markdown(message["content"])
 
79
  ## ------------------------------------------------------------------------------------------------
80
  ## Patient part
81
 
82
+ index_name = "indexes/Headache/QA"
83
 
84
  if "store" not in st.session_state:
85
  st.session_state.store = db.get_store(index_name, embeddings=embeddings)
 
150
  ## ------------------------------------------------------------------------------------------------
151
  ## ------------------------------------------------------------------------------------------------
152
  ## Grader part
153
+ index_name = "indexes/Headache/Rubric"
154
 
155
  # store = FAISS.load_local(index_name, embeddings)
156
 
 
263
  # client = OpenAI(api_key=key)
264
 
265
  st.title("UAT for PatientLLM and GraderLLM")
266
+ st.title("Headache only, for now")
267
+
268
+ if st.button("Clear History and Memory", type="primary"):
269
+ st.session_state.messages_1 = []
270
+ st.session_state.messages_2 = []
271
+ st.session_state.memory = ConversationSummaryBufferMemory(llm=llm, memory_key="chat_history", input_key="question" )
272
+ memory = st.session_state.memory
273
 
274
  ## Testing HTML
275
  # html_string = """
 
304
 
305
  st.write("Timer has been removed, switch with this button")
306
 
307
+ if st.button(f"Switch to {'PATIENT' if st.session_state.active_chat==2 else 'GRADER'}"+".... Buggy button, please double click"):
 
308
  st.session_state.active_chat = 3 - st.session_state.active_chat
309
 
310
+ # st.write("Currently in " + ('PATIENT' if st.session_state.active_chat==2 else 'GRADER'))
311
 
312
  # Create two columns for the two chat interfaces
313
  col1, col2 = st.columns(2)
 
321
 
322
  # Second chat interface
323
  with col2:
324
+ # st.write("pls dun spam this, its tons of tokens cos chat history")
325
  st.subheader("Grader LLM")
326
+ st.write("grader takes a while to load... please be patient")
327
  for message in st.session_state.messages_2:
328
  with st.chat_message(message["role"]):
329
  st.markdown(message["content"])