relatable / app.py
starmaq's picture
Setup model
e46be7c
raw
history blame contribute delete
334 Bytes
import gradio as gr
import json
from sentence_transformers import SentenceTransformer
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
def give_embeddings(sentence):
return json.dumps(model.encode([sentence])[0].tolist())
demo = gr.Interface(fn=give_embeddings, inputs="text", outputs="text")
demo.launch()