Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,6 +48,17 @@ def add_text_inputs(i):
|
|
48 |
def main():
|
49 |
st.title('Pairwise Cosine Distance Calculator')
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
num_pairs = st.sidebar.number_input('Number of Text Input Pairs', min_value=1, max_value=10, value=5)
|
52 |
|
53 |
std_text_inputs = []
|
@@ -77,13 +88,15 @@ def main():
|
|
77 |
outputs['ugc'] = np.tile(ugc_text_inputs, 3)
|
78 |
outputs['cos'] = np.concatenate([X_cos_laser, X_cos_rolaser, X_cos_c_rolaser])
|
79 |
|
80 |
-
st.
|
81 |
-
|
|
|
82 |
fig.update_xaxes(title_text='Text Input Pair')
|
83 |
fig.update_yaxes(title_text='Cosine Distance')
|
84 |
st.plotly_chart(fig, use_container_width=True)
|
85 |
|
86 |
-
st.
|
|
|
87 |
st.write(outputs.groupby('model')['cos'].describe())
|
88 |
|
89 |
|
|
|
48 |
def main():
|
49 |
st.title('Pairwise Cosine Distance Calculator')
|
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', min_value=1, max_value=10, value=5)
|
63 |
|
64 |
std_text_inputs = []
|
|
|
88 |
outputs['ugc'] = np.tile(ugc_text_inputs, 3)
|
89 |
outputs['cos'] = np.concatenate([X_cos_laser, X_cos_rolaser, X_cos_c_rolaser])
|
90 |
|
91 |
+
st.header('Cosine Distance Scores:')
|
92 |
+
st.caption('*This bar plot is interactive: Hover on the bars to display values. Click on the legend to filter models.*')
|
93 |
+
fig = px.bar(outputs, x='pair', y='cos', color='model', barmode='group', hover_data=['ugc', 'std'])
|
94 |
fig.update_xaxes(title_text='Text Input Pair')
|
95 |
fig.update_yaxes(title_text='Cosine Distance')
|
96 |
st.plotly_chart(fig, use_container_width=True)
|
97 |
|
98 |
+
st.header('Average Cosine Distance Scores:')
|
99 |
+
st.caption('*This data table is interactive: Click on a column header to sort values.*')
|
100 |
st.write(outputs.groupby('model')['cos'].describe())
|
101 |
|
102 |
|