File size: 588 Bytes
06aae6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from sentence_transformers import SentenceTransformer

model_Q = SentenceTransformer('flax-sentence-embeddings/multi-QA_v1-mpnet-asymmetric-Q')

def getVectors(sentences):
            vectors = []
            splitSentences = sentences.split('/*/')
            for sentence in sentences:
                        vectors.append(model_Q.encode(sentence))
            return vectors
            
interface = gr.Interface(fn = getVectors,
inputs = "text",
outputs = ['text'],
title = 'get vectors',
description = 'get vectors for search')

interface.launch(inline = False)