Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
from sentence_transformers import SentenceTransformer, util
|
| 3 |
|
| 4 |
model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2')
|
|
@@ -17,5 +18,8 @@ if st.button("Guess"):
|
|
| 17 |
word_embedding = model.encode(word)
|
| 18 |
similarity = util.pytorch_cos_sim(secred_embedding, word_embedding).cpu().numpy()[0][0]
|
| 19 |
st.session_state['words'].append((word, similarity))
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
from sentence_transformers import SentenceTransformer, util
|
| 4 |
|
| 5 |
model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2')
|
|
|
|
| 18 |
word_embedding = model.encode(word)
|
| 19 |
similarity = util.pytorch_cos_sim(secred_embedding, word_embedding).cpu().numpy()[0][0]
|
| 20 |
st.session_state['words'].append((word, similarity))
|
| 21 |
+
words_df = pd.DataFrame(
|
| 22 |
+
st.session_state['words'],
|
| 23 |
+
columns=["word", "similarity"]
|
| 24 |
+
).sort_values(by=["similarity"], ascending=False)
|
| 25 |
+
st.dataframe(words_df)
|