File size: 421 Bytes
cc358f7
 
 
8b29ba8
cc358f7
 
 
 
 
ad46bfd
 
cc358f7
 
 
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_Q = SentenceTransformer('sentence-transformers/all-MiniLM-L12-v2')

def text_to_embedding(text):
    embedding = model_Q.encode(text)
    return embedding

inputs = gr.Textbox(default="Type text here.")
outputs = gr.Textbox()

app = gr.Interface(fn=text_to_embedding, inputs=inputs, outputs=outputs, title="Text to Embedding")
app.launch()