from sentence_transformers import SentenceTransformer | |
import gradio as gr | |
model = SentenceTransformer('sentence-transformers/multi-qa-mpnet-base-cos-v1') | |
def generate_embedding(query): | |
return model.encode(query) | |
demo = gr.Interface(fn=generate_embedding, inputs="text", outputs="text") | |
demo.launch( show_api=True) |