Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from sentence_transformers import SentenceTransformer
|
3 |
+
from sentence_transformers.util import cos_sim
|
4 |
+
model = SentenceTransformer('keithhon/paraphrase-multilingual-MiniLM-L12-v2')
|
5 |
+
|
6 |
+
def compute_similarity_score(name1, name2):
|
7 |
+
return cos_sim(model.encode(name1), model.encode(name2)).tolist()[0]
|
8 |
+
|
9 |
+
iface = gr.Interface(fn=compute_similarity_score, inputs=["text","text"], outputs="text")
|
10 |
+
iface.launch()
|