Spaces:
Sleeping
Sleeping
Gordon Weakliem
commited on
Commit
·
dfe1df2
1
Parent(s):
7ecae86
Add simple form
Browse files
app.py
CHANGED
@@ -1,4 +1,16 @@
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
|
|
|
3 |
x = st.slider('Select a value')
|
4 |
st.write(x, 'squared is', x * x)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from sentence_transformers import SentenceTransformer, SimilarityFunction
|
2 |
+
|
3 |
import streamlit as st
|
4 |
|
5 |
+
st.
|
6 |
x = st.slider('Select a value')
|
7 |
st.write(x, 'squared is', x * x)
|
8 |
+
|
9 |
+
model = SentenceTransformer(model_name, trust_remote_code=True)
|
10 |
+
embeddings = model.encode(sentences, prompt_name="passage")
|
11 |
+
|
12 |
+
similarity_fn_enum = getattr(SimilarityFunction, similarity_fn.upper())
|
13 |
+
model.similarity_fn_name = similarity_fn_enum
|
14 |
+
|
15 |
+
similarities = model.similarity(embeddings[0], embeddings[1])
|
16 |
+
print(f"similarity: {similarities}")
|