devtrent commited on
Commit
0be3a1a
1 Parent(s): 7e55908

Remove sidebar

Browse files
Files changed (1) hide show
  1. app.py +21 -22
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
- if anchor:
29
- select_models = st.sidebar.multiselect("Choose models", options=MODELS_ID.keys(), default=MODELS_ID.keys()[0])
30
- n_texts = st.sidebar.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.sidebar.text_input(f'Text {i + 1}:')
39
 
40
- inputs.append(input)
41
 
42
- if anchor:
43
- if st.sidebar.button('Tell me the similarity.'):
44
- results = {model: inference.text_similarity(anchor, inputs, model) for model in select_models}
45
- df_results = {model: results[model] for model in results}
46
 
47
- index = inputs
48
- df_total = pd.DataFrame(index=index)
49
- for key, value in df_results.items():
50
- df_total[key] = list(value['score'].values)
51
 
52
- st.write('Here are the results for selected models:')
53
- st.write(df_total)
54
- st.write('Visualize the results of each model:')
55
- st.area_chart(df_total)
 
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)