File size: 447 Bytes
8b66f10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gradio as gr
from sentence_transformers import SentenceTransformer

model = SentenceTransformer('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2') 

def encode_sentences(sentences):
    embeddings = model.encode(sentences)
    return embeddings

demo = gr.Interface(fn=encode_sentences, 
                    inputs="textbox", 
                    outputs="text")
                    
if __name__ == "__main__":
    demo.launch()