Spaces:
Runtime error
Runtime error
File size: 404 Bytes
b0daf5f a470c1f b0daf5f a470c1f cfcb632 a470c1f b0daf5f 7c21073 b0daf5f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import gradio as gr
from sentence_transformers.util import cos_sim
import numpy as np
def textToFloatVector(text):
x = np.fromstring(a, dtype=float, sep=',')
vec = x.astype(np.float)
return vec
def compute(text1, text2):
return cos_sim(textToFloatVector(text1), textToFloatVector(text2))
iface = gr.Interface(fn=compute, inputs=["text","text"], outputs="text")
iface.launch() |