robinroy03's picture
first commit
fd39c21
raw
history blame
569 Bytes
from flask import Flask
from flask import request
from sentence_transformers import SentenceTransformer
app = Flask(__name__)
model = SentenceTransformer('Alibaba-NLP/gte-large-en-v1.5', trust_remote_code=True)
@app.route("/embedding", methods=['POST'])
def embedding():
"""
{
text: <text>
}
"""
message = request.get_json()
message = model.encode(message)
return model.encode(message['text'])
# curl -v -X POST 'http://127.0.0.1:8000/completion' --header 'Content-Type: application/json' --data '{"text": "what is an apple?"}'