Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -133,10 +133,10 @@ if text:
|
|
133 |
outputs = model(**new_tokens)
|
134 |
outputs_finbert = model_finbert(**new_tokens_finbert)
|
135 |
outputs_sapbert = model_sapbert(**new_tokens_sapbert)
|
136 |
-
sim_dict = calculate_top_k(outputs, new_tokens, text, kp_dict, exclude_text=exclude_text,exclude_words=exclude_words,k=k)
|
137 |
-
sim_dict_finbert = calculate_top_k(outputs_finbert, new_tokens_finbert, text, kp_dict_finbert, exclude_text=exclude_text,exclude_words=exclude_words,k=k)
|
138 |
-
sim_dict_sapbert = calculate_top_k(outputs_sapbert, new_tokens_sapbert, text, kp_dict_sapbert, exclude_text=exclude_text,exclude_words=exclude_words,k=k, pooler=False)
|
139 |
if not diversify_box:
|
|
|
|
|
|
|
140 |
with col1:
|
141 |
st.write("distilbert-cvent")
|
142 |
st.json(sim_dict)
|
@@ -147,6 +147,9 @@ if text:
|
|
147 |
st.write("sapbert")
|
148 |
st.json(sim_dict_sapbert)
|
149 |
else:
|
|
|
|
|
|
|
150 |
idxs = extract_idxs(sim_dict, kp_dict)
|
151 |
idxs_finbert = extract_idxs(sim_dict_finbert, kp_dict_finbert)
|
152 |
idxs_sapbert = extract_idxs(sim_dict_sapbert, kp_dict_sapbert)
|
|
|
133 |
outputs = model(**new_tokens)
|
134 |
outputs_finbert = model_finbert(**new_tokens_finbert)
|
135 |
outputs_sapbert = model_sapbert(**new_tokens_sapbert)
|
|
|
|
|
|
|
136 |
if not diversify_box:
|
137 |
+
sim_dict = calculate_top_k(outputs, new_tokens, text, kp_dict, exclude_text=exclude_text,exclude_words=exclude_words,k=k_diversify)
|
138 |
+
sim_dict_finbert = calculate_top_k(outputs_finbert, new_tokens_finbert, text, kp_dict_finbert, exclude_text=exclude_text,exclude_words=exclude_words,k=k_diversify)
|
139 |
+
sim_dict_sapbert = calculate_top_k(outputs_sapbert, new_tokens_sapbert, text, kp_dict_sapbert, exclude_text=exclude_text,exclude_words=exclude_words,k=k_diversify, pooler=False)
|
140 |
with col1:
|
141 |
st.write("distilbert-cvent")
|
142 |
st.json(sim_dict)
|
|
|
147 |
st.write("sapbert")
|
148 |
st.json(sim_dict_sapbert)
|
149 |
else:
|
150 |
+
sim_dict = calculate_top_k(outputs, new_tokens, text, kp_dict, exclude_text=exclude_text,exclude_words=exclude_words,k=k)
|
151 |
+
sim_dict_finbert = calculate_top_k(outputs_finbert, new_tokens_finbert, text, kp_dict_finbert, exclude_text=exclude_text,exclude_words=exclude_words,k=k)
|
152 |
+
sim_dict_sapbert = calculate_top_k(outputs_sapbert, new_tokens_sapbert, text, kp_dict_sapbert, exclude_text=exclude_text,exclude_words=exclude_words,k=k, pooler=False)
|
153 |
idxs = extract_idxs(sim_dict, kp_dict)
|
154 |
idxs_finbert = extract_idxs(sim_dict_finbert, kp_dict_finbert)
|
155 |
idxs_sapbert = extract_idxs(sim_dict_sapbert, kp_dict_sapbert)
|