lydianish commited on
Commit
eec55b9
·
verified ·
1 Parent(s): f095c1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -12
app.py CHANGED
@@ -50,23 +50,19 @@ def main():
50
 
51
  info = '''
52
  :bookmark: **Paper:** [Making Sentence Embeddings Robust to User-Generated Content (Nishimwe et al., 2024)](https://arxiv.org/abs/2403.17220)
53
- :link: **Github:** [https://github.com/lydianish/RoLASER](https://github.com/lydianish/RoLASER)
54
-
55
- This demo app computes text embeddings of sentence pairs using the LASER encoder and its robust students RoLASER and c-RoLASER.
56
- The pairwise cosine distances between the sentences are then computed and displayed.
57
  '''
58
  st.markdown(info)
59
 
60
- st.header('Standard and Non-standard Text Input Pairs:')
61
 
62
- num_pairs = st.sidebar.number_input('Number of Text Input Pairs (1-10)', min_value=1, max_value=10, value=5)
 
63
 
64
  with st.form('text_input_form'):
65
  col1, col2 = st.columns(2)
66
- with col1:
67
- st.write('Enter standard text here:')
68
- with col2:
69
- st.write('Enter non-standard text here:')
70
 
71
  std_text_inputs = []
72
  ugc_text_inputs = []
@@ -103,14 +99,14 @@ def main():
103
  outputs['ugc'] = np.tile(ugc_text_inputs, 3)
104
  outputs['cos'] = np.concatenate([X_cos_laser, X_cos_rolaser, X_cos_c_rolaser])
105
 
106
- st.header('Cosine Distance Scores:')
107
  st.caption('*This bar plot is interactive: Hover on the bars to display values. Click on the legend items to filter models.*')
108
  fig = px.bar(outputs, x='pair', y='cos', color='model', barmode='group', hover_data=['ugc', 'std'])
109
  fig.update_xaxes(title_text='Text Input Pair')
110
  fig.update_yaxes(title_text='Cosine Distance')
111
  st.plotly_chart(fig, use_container_width=True)
112
 
113
- st.header('Average Cosine Distance Scores:')
114
  st.caption('*This data table is interactive: Click on a column header to sort values.*')
115
  st.write(outputs.groupby('model')['cos'].describe())
116
 
 
50
 
51
  info = '''
52
  :bookmark: **Paper:** [Making Sentence Embeddings Robust to User-Generated Content (Nishimwe et al., 2024)](https://arxiv.org/abs/2403.17220)
53
+ :link: **Github:** [https://github.com/lydianish/RoLASER](https://github.com/lydianish/RoLASER)
 
 
 
54
  '''
55
  st.markdown(info)
56
 
57
+ st.header('Standard and Non-standard Text Input Pairs')
58
 
59
+ cols = st.columns(3)
60
+ num_pairs = cols[1].number_input('Number of Text Input Pairs (1-10):', min_value=1, max_value=10, value=5)
61
 
62
  with st.form('text_input_form'):
63
  col1, col2 = st.columns(2)
64
+ col1.write('Enter standard text here:')
65
+ col2.write('Enter non-standard text here:')
 
 
66
 
67
  std_text_inputs = []
68
  ugc_text_inputs = []
 
99
  outputs['ugc'] = np.tile(ugc_text_inputs, 3)
100
  outputs['cos'] = np.concatenate([X_cos_laser, X_cos_rolaser, X_cos_c_rolaser])
101
 
102
+ st.header('Cosine Distance Scores')
103
  st.caption('*This bar plot is interactive: Hover on the bars to display values. Click on the legend items to filter models.*')
104
  fig = px.bar(outputs, x='pair', y='cos', color='model', barmode='group', hover_data=['ugc', 'std'])
105
  fig.update_xaxes(title_text='Text Input Pair')
106
  fig.update_yaxes(title_text='Cosine Distance')
107
  st.plotly_chart(fig, use_container_width=True)
108
 
109
+ st.header('Average Cosine Distance Scores')
110
  st.caption('*This data table is interactive: Click on a column header to sort values.*')
111
  st.write(outputs.groupby('model')['cos'].describe())
112