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() |