AyoubChLin's picture
Create app.py
8ff78e6
raw
history blame
No virus
519 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="Select hot dog candidate"),
outputs=gr.Text(label="Embedding"),
title="Embedding",
)
if __name__ == "__main__":
gradio_app.launch()