vectorAPI / app.py
summerstay's picture
Update app.py
eb548ff
raw
history blame contribute delete
586 Bytes
import gradio as gr
from sentence_transformers import SentenceTransformer
model_Q = SentenceTransformer('sentence-transformers/all-mpnet-base-v2')
def getVectors(sentences):
vectors = []
splitSentences = sentences.split('ZZZ')
for sentence in splitSentences:
vectors.append(model_Q.encode(sentence).tolist())
return vectors
interface = gr.Interface(fn = getVectors,
inputs = "text",
outputs = ['text'],
title = 'get vectors',
description = 'get vectors for search')
interface.launch(inline = False)