import gradio as gr import json from sentence_transformers import SentenceTransformer model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2') def give_embeddings(sentence): return json.dumps(model.encode([sentence])[0].tolist()) demo = gr.Interface(fn=give_embeddings, inputs="text", outputs="text") demo.launch()