mbosse99 commited on
Commit
8c44016
·
1 Parent(s): c73cf52

update with rerank score

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -293,6 +293,11 @@ def check_keywords_in_content(database_path, table_name, input_id, keywords):
293
 
294
  return contains_keywords
295
 
 
 
 
 
 
296
  def load_candidates(fillup):
297
  with st.spinner("Load the candidates, this may take a moment..."):
298
  # print(st.session_state["job_string"])
@@ -506,7 +511,7 @@ if st.session_state["job"]:
506
  # st.write("Switch from a similarity search (default) to a hybrid search (activated)")
507
  # st.toggle("Switch Search", key="search_type")
508
 
509
- st.radio("Select a search variant",options=["Similarity", "Hybrid", "Semantic ranking"], key="search_radio")
510
 
511
  st.write("Activate the following toggles to filter according to the respective properties:")
512
  col_screening, col_handoff, col_placed = st.columns([1,1,1])
@@ -549,8 +554,15 @@ if (st.session_state["job_string"] and submit) or st.session_state["docs_res"]:
549
  st.rerun()
550
  with cols_final[0]:
551
  # st.subheader(doc.metadata["source"])
552
- with st.expander(doc[0].metadata["name"]+" with a search score of: "+str(round(doc[1] * 100, 3))+ ("%"if st.session_state["search_radio"] == "Similarity" else "")):
553
- st.write(doc[0].page_content)
 
 
 
 
 
 
 
554
  if len(st.session_state["docs_res"])>=10:
555
  if st.button("Accept candidates", key="accept_candidates_btn"):
556
  print("hello")
@@ -744,4 +756,5 @@ Your Candidate-Search-Tool
744
  st.success('The dispatch and the upload of the data was successful')
745
  except Exception as e:
746
  st.error("Unfortunately the SMS dispatch did not work. Please reload the page and try again or contact the administrator. ", icon="🚨")
747
- print("Fehler beim Senden der SMS:", str(e))
 
 
293
 
294
  return contains_keywords
295
 
296
+ def clear_temp_candidates():
297
+ if not st.session_state["final_candidates"]:
298
+ print("i am cleared")
299
+ st.session_state["docs_res"] = []
300
+
301
  def load_candidates(fillup):
302
  with st.spinner("Load the candidates, this may take a moment..."):
303
  # print(st.session_state["job_string"])
 
511
  # st.write("Switch from a similarity search (default) to a hybrid search (activated)")
512
  # st.toggle("Switch Search", key="search_type")
513
 
514
+ st.radio("Select a search variant",options=["Similarity", "Hybrid", "Semantic ranking"], key="search_radio",on_change=clear_temp_candidates)
515
 
516
  st.write("Activate the following toggles to filter according to the respective properties:")
517
  col_screening, col_handoff, col_placed = st.columns([1,1,1])
 
554
  st.rerun()
555
  with cols_final[0]:
556
  # st.subheader(doc.metadata["source"])
557
+ if st.session_state["search_radio"] == "Similarity":
558
+ with st.expander(doc[0].metadata["name"]+" with a similarity percentage of: "+str(round(doc[1] * 100, 3))+ "%"):
559
+ st.write(doc[0].page_content)
560
+ elif st.session_state["search_radio"] == "Hybrid":
561
+ with st.expander(doc[0].metadata["name"]+" with a hybrid search score of: "+str(round(doc[1] * 100, 3))):
562
+ st.write(doc[0].page_content)
563
+ elif st.session_state["search_radio"] == "Semantic ranking":
564
+ with st.expander(doc[0].metadata["name"]+" with a rerank score of: "+str(round(doc[2] * 100, 3))):
565
+ st.write(doc[0].page_content)
566
  if len(st.session_state["docs_res"])>=10:
567
  if st.button("Accept candidates", key="accept_candidates_btn"):
568
  print("hello")
 
756
  st.success('The dispatch and the upload of the data was successful')
757
  except Exception as e:
758
  st.error("Unfortunately the SMS dispatch did not work. Please reload the page and try again or contact the administrator. ", icon="🚨")
759
+ print("Fehler beim Senden der SMS:", str(e))
760
+