keithhon's picture
Upload app.py with huggingface_hub
1dad570
raw
history blame
422 Bytes
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()