File size: 499 Bytes
8ff78e6 327bdfe 8ff78e6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from sentence_transformers import SentenceTransformer
# Load the model
model = SentenceTransformer('sentence-transformers/msmarco-distilbert-dot-v5')
# Function to get the embedding
def embedding(text):
text_emb = model.encode(text)
return text_emb
# Define the Streamlit app
gradio_app = gr.Interface(
embedding,
inputs=gr.Text(label="TEXT"),
outputs=gr.Text(label="Embedding"),
title="Embedding",
)
if __name__ == "__main__":
gradio_app.launch() |