AyoubChLin's picture
Update app.py
327bdfe verified
raw
history blame contribute delete
No virus
499 Bytes
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()