Spaces:
Runtime error
Runtime error
Trent
commited on
Commit
•
0be3a1a
1
Parent(s):
7e55908
Remove sidebar
Browse files
app.py
CHANGED
@@ -21,35 +21,34 @@ For more cool information on sentence embeddings, see the [sBert project](https:
|
|
21 |
Please enjoy!!
|
22 |
''')
|
23 |
|
|
|
|
|
24 |
anchor = st.text_input(
|
25 |
'Please enter here the main text you want to compare:'
|
26 |
)
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
value=2,
|
33 |
-
min_value=2)
|
34 |
|
35 |
-
|
36 |
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
|
42 |
-
if
|
43 |
-
|
44 |
-
|
45 |
-
df_results = {model: results[model] for model in results}
|
46 |
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
|
|
21 |
Please enjoy!!
|
22 |
''')
|
23 |
|
24 |
+
select_models = st.multiselect("Choose models", options=MODELS_ID.keys(), default=MODELS_ID.keys()[0])
|
25 |
+
|
26 |
anchor = st.text_input(
|
27 |
'Please enter here the main text you want to compare:'
|
28 |
)
|
29 |
|
30 |
+
n_texts = st.number_input(
|
31 |
+
f'''How many texts you want to compare with: '{anchor}'?''',
|
32 |
+
value=2,
|
33 |
+
min_value=2)
|
|
|
|
|
34 |
|
35 |
+
inputs = []
|
36 |
|
37 |
+
for i in range(n_texts):
|
38 |
+
input = st.text_input(f'Text {i + 1}:')
|
39 |
|
40 |
+
inputs.append(input)
|
41 |
|
42 |
+
if st.button('Tell me the similarity.'):
|
43 |
+
results = {model: inference.text_similarity(anchor, inputs, model) for model in select_models}
|
44 |
+
df_results = {model: results[model] for model in results}
|
|
|
45 |
|
46 |
+
index = inputs
|
47 |
+
df_total = pd.DataFrame(index=index)
|
48 |
+
for key, value in df_results.items():
|
49 |
+
df_total[key] = list(value['score'].values)
|
50 |
|
51 |
+
st.write('Here are the results for selected models:')
|
52 |
+
st.write(df_total)
|
53 |
+
st.write('Visualize the results of each model:')
|
54 |
+
st.area_chart(df_total)
|