georad commited on
Commit
fdd828e
·
verified ·
1 Parent(s): 5d41255

Update pages/type_text.py

Browse files
Files changed (1) hide show
  1. pages/type_text.py +3 -3
pages/type_text.py CHANGED
@@ -9,7 +9,7 @@ from sentence_transformers import SentenceTransformer, util
9
  import os
10
  os.getenv("HF_TOKEN")
11
 
12
- st.header("Map internal descriptions to SBS codes using Sentence Transformer + Reasoning Models")
13
  st.subheader("Select specific Chapter for quicker results")
14
  #df_chapters = pd.read_csv("SBS_V2_0/Chapter_Index_Rows.csv")
15
  df_chapters = pd.read_csv("SBS_V2_0/Chapter_Index_Rows_with_total.csv")
@@ -159,7 +159,6 @@ pipe = load_pipe()
159
 
160
 
161
  #mapSBS_button = st.button("Map to SBS codes", on_click=on_click, key="user_clickedSBS")
162
- #mapSBS_button = st.button("Map to SBS codes") #, key="user_clickedSBS")
163
 
164
  INTdesc_embedding = model.encode(INTdesc_input)
165
 
@@ -178,7 +177,8 @@ if INTdesc_input is not None and st.button("Map to SBS codes"):
178
  HF_model_results_displayed = HF_model_results_sorted[0:numMAPPINGS_input]
179
 
180
 
181
- if INTdesc_input is not None and mapSBS_button == True:
 
182
  for i, result in enumerate(HF_model_results_displayed):
183
  dictA.update({"Score": "%.4f" % result[0]["score"], "SBS Code": df_SBS.loc[df_SBS["Long_Description"] == SBScorpus[result[0]["corpus_id"]],"SBS_Code_Hyphenated"].values[0], "SBS Description V2.0": SBScorpus[result[0]["corpus_id"]]})
184
  dfALL = pd.concat([dfALL, pd.DataFrame([dictA])], ignore_index=True)
 
9
  import os
10
  os.getenv("HF_TOKEN")
11
 
12
+ st.header("Map internal descriptions to SBS codes with Sentence Transformer + Reasoning Models")
13
  st.subheader("Select specific Chapter for quicker results")
14
  #df_chapters = pd.read_csv("SBS_V2_0/Chapter_Index_Rows.csv")
15
  df_chapters = pd.read_csv("SBS_V2_0/Chapter_Index_Rows_with_total.csv")
 
159
 
160
 
161
  #mapSBS_button = st.button("Map to SBS codes", on_click=on_click, key="user_clickedSBS")
 
162
 
163
  INTdesc_embedding = model.encode(INTdesc_input)
164
 
 
177
  HF_model_results_displayed = HF_model_results_sorted[0:numMAPPINGS_input]
178
 
179
 
180
+ #if INTdesc_input is not None and mapSBS_button == True:
181
+ if INTdesc_input is not None and st.button("Map to SBS codes"):
182
  for i, result in enumerate(HF_model_results_displayed):
183
  dictA.update({"Score": "%.4f" % result[0]["score"], "SBS Code": df_SBS.loc[df_SBS["Long_Description"] == SBScorpus[result[0]["corpus_id"]],"SBS_Code_Hyphenated"].values[0], "SBS Description V2.0": SBScorpus[result[0]["corpus_id"]]})
184
  dfALL = pd.concat([dfALL, pd.DataFrame([dictA])], ignore_index=True)