Spaces:
Runtime error
Runtime error
taskswithcode
commited on
Commit
•
e7ea687
1
Parent(s):
07e062e
Fix
Browse files
app.py
CHANGED
@@ -137,8 +137,8 @@ def run_test(model_names,model_name,sentences,display_area,main_index,user_uploa
|
|
137 |
|
138 |
def display_results(orig_sentences,main_index,results,response_info,app_mode):
|
139 |
main_sent = f"<div style=\"font-size:14px; color: #2f2f2f; text-align: left\">{response_info}<br/><br/></div>"
|
140 |
-
score_text = "cosine_distance" if app_mode ==
|
141 |
-
pivot_name = "main sentence" if app_mode ==
|
142 |
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>"
|
143 |
pivot_name = pivot_name[0].upper() + pivot_name[1:]
|
144 |
main_sent += f"<div style=\"font-size:16px; color: #2f2f2f; text-align: left\"><b>{pivot_name}:</b> {orig_sentences[main_index]}</div>"
|
@@ -193,7 +193,7 @@ def app_main(app_mode,example_files,model_name_files):
|
|
193 |
selected_model = st.selectbox(label=selection_label,
|
194 |
options = options_arr, index=0, key = "twc_model")
|
195 |
st.write("")
|
196 |
-
if (app_mode ==
|
197 |
main_index = st.number_input('Step 3. Enter index of sentence in file to make it the main sentence',value=1,min_value = 1)
|
198 |
else:
|
199 |
main_index = 1
|
|
|
137 |
|
138 |
def display_results(orig_sentences,main_index,results,response_info,app_mode):
|
139 |
main_sent = f"<div style=\"font-size:14px; color: #2f2f2f; text-align: left\">{response_info}<br/><br/></div>"
|
140 |
+
score_text = "cosine_distance" if app_mode == SEM_SIMILARITY else "cosine_distance/score"
|
141 |
+
pivot_name = "main sentence" if app_mode == SEM_SIMILARITY else "query"
|
142 |
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>"
|
143 |
pivot_name = pivot_name[0].upper() + pivot_name[1:]
|
144 |
main_sent += f"<div style=\"font-size:16px; color: #2f2f2f; text-align: left\"><b>{pivot_name}:</b> {orig_sentences[main_index]}</div>"
|
|
|
193 |
selected_model = st.selectbox(label=selection_label,
|
194 |
options = options_arr, index=0, key = "twc_model")
|
195 |
st.write("")
|
196 |
+
if (app_mode == SEM_SIMILARITY):
|
197 |
main_index = st.number_input('Step 3. Enter index of sentence in file to make it the main sentence',value=1,min_value = 1)
|
198 |
else:
|
199 |
main_index = 1
|