taskswithcode commited on
Commit
93c89d0
1 Parent(s): f09cc2c
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -136,8 +136,8 @@ def run_test(model_names,model_name,sentences,display_area,main_index,user_uploa
136
 
137
  def display_results(orig_sentences,main_index,results,response_info,app_mode):
138
  main_sent = f"<div style=\"font-size:14px; color: #2f2f2f; text-align: left\">{response_info}<br/><br/></div>"
139
- score_text = "cosine_distance" if app_mode == "similarity" else "cosine_distance/score"
140
- pivot_name = "main sentence" if app_mode == "similarity" else "query"
141
  main_sent += f"<div style=\"font-size:14px; color: #6f6f6f; text-align: left\">Results sorted by {score_text}. Closest to furthest away from {pivot_name}</div>"
142
  pivot_name = pivot_name[0].upper() + pivot_name[1:]
143
  main_sent += f"<div style=\"font-size:16px; color: #2f2f2f; text-align: left\"><b>{pivot_name}:</b>&nbsp;&nbsp;{orig_sentences[main_index]}</div>"
@@ -192,7 +192,7 @@ def app_main(app_mode,example_files,model_name_files):
192
  selected_model = st.selectbox(label=selection_label,
193
  options = options_arr, index=0, key = "twc_model")
194
  st.write("")
195
- if (app_mode == "similarity"):
196
  main_index = st.number_input('Step 3. Enter index of sentence in file to make it the main sentence',value=1,min_value = 1)
197
  else:
198
  main_index = 1
 
136
 
137
  def display_results(orig_sentences,main_index,results,response_info,app_mode):
138
  main_sent = f"<div style=\"font-size:14px; color: #2f2f2f; text-align: left\">{response_info}<br/><br/></div>"
139
+ score_text = "cosine_distance" if app_mode == SEM_SIMILARITY else "cosine_distance/score"
140
+ pivot_name = "main sentence" if app_mode == SEM_SIMILARITY else "query"
141
  main_sent += f"<div style=\"font-size:14px; color: #6f6f6f; text-align: left\">Results sorted by {score_text}. Closest to furthest away from {pivot_name}</div>"
142
  pivot_name = pivot_name[0].upper() + pivot_name[1:]
143
  main_sent += f"<div style=\"font-size:16px; color: #2f2f2f; text-align: left\"><b>{pivot_name}:</b>&nbsp;&nbsp;{orig_sentences[main_index]}</div>"
 
192
  selected_model = st.selectbox(label=selection_label,
193
  options = options_arr, index=0, key = "twc_model")
194
  st.write("")
195
+ if (app_mode == SEM_SIMILARITY):
196
  main_index = st.number_input('Step 3. Enter index of sentence in file to make it the main sentence',value=1,min_value = 1)
197
  else:
198
  main_index = 1