File size: 422 Bytes
1dad570
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import gradio as gr
from sentence_transformers import SentenceTransformer
from sentence_transformers.util import cos_sim
model = SentenceTransformer('keithhon/paraphrase-multilingual-MiniLM-L12-v2')

def compute_similarity_score(name1, name2):
    return cos_sim(model.encode(name1), model.encode(name2)).tolist()[0]

iface = gr.Interface(fn=compute_similarity_score, inputs=["text","text"], outputs="text")
iface.launch()