from sentence_transformers import SentenceTransformer | |
import gradio as gr | |
model = SentenceTransformer('sentence-transformers/multi-qa-mpnet-base-cos-v1') | |
def generate_embedding(query): | |
# return "Connected" | |
embeddings = model.encode(query).tolist() | |
# resposne = "" | |
# for(char in embeddings): | |
# resposne += char + " " | |
mySeparator = " " | |
resposne = mySeparator.join(embeddings) | |
return resposne | |
demo = gr.Interface(fn=generate_embedding, inputs="text", outputs="text") | |
demo.launch( show_api=True) |