Spaces:
Runtime error
Runtime error
Catherine Breslin
commited on
Commit
•
b394295
1
Parent(s):
6efa95a
Minor formatting
Browse files
app.py
CHANGED
@@ -48,9 +48,9 @@ st.markdown("This demo uses the sentence_transformers library to plot sentence s
|
|
48 |
# Streamlit text boxes
|
49 |
text = st.text_area('Enter sentences:', value="The sun is hotter than the moon.\nThe sun is very bright.\nI hear that the universe is very large.\nToday is Tuesday.")
|
50 |
|
51 |
-
nc = st.slider('Select a number of clusters', min_value=1, max_value=15, value=3)
|
52 |
|
53 |
-
model_type = st.radio("Choose model", ('Sentence Transformer', 'Universal Sentence Encoder'), index=0)
|
54 |
|
55 |
# Model setup
|
56 |
if model_type == "Sentence Transformer":
|
@@ -72,6 +72,7 @@ if text:
|
|
72 |
for i,em in enumerate(embed):
|
73 |
for j,ea in enumerate(embed):
|
74 |
sim[i][j] = 1.0-cosine(em,ea)
|
|
|
75 |
plot_heatmap(sentences, sim)
|
76 |
st.subheader("Results from K-Means Clustering")
|
77 |
cluster_examples(sentences, embed, nc)
|
|
|
48 |
# Streamlit text boxes
|
49 |
text = st.text_area('Enter sentences:', value="The sun is hotter than the moon.\nThe sun is very bright.\nI hear that the universe is very large.\nToday is Tuesday.")
|
50 |
|
51 |
+
nc = st.slider('Select a number of clusters:', min_value=1, max_value=15, value=3)
|
52 |
|
53 |
+
model_type = st.radio("Choose model:", ('Sentence Transformer', 'Universal Sentence Encoder'), index=0)
|
54 |
|
55 |
# Model setup
|
56 |
if model_type == "Sentence Transformer":
|
|
|
72 |
for i,em in enumerate(embed):
|
73 |
for j,ea in enumerate(embed):
|
74 |
sim[i][j] = 1.0-cosine(em,ea)
|
75 |
+
st.subheader("Similarity Heatmap")
|
76 |
plot_heatmap(sentences, sim)
|
77 |
st.subheader("Results from K-Means Clustering")
|
78 |
cluster_examples(sentences, embed, nc)
|