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()