from sentence_transformers.util import cos_sim import gradio as gr module_url = "https://tfhub.dev/google/universal-sentence-encoder/4" import tensorflow_hub as hub model = hub.load(module_url) def compute_similarity_score(name1, name2): return cos_sim(model([name1]), model([name2])) iface = gr.Interface(fn=compute_similarity_score, inputs=["text","text"], outputs="text") iface.launch()