POST http://cm-0.tepper.cmu.edu:6000/v1/embedding
Header={ authorization:convmind, Content-Type:application/json}
body={"sentences": ["This framework generates embeddings for each input sentence"]}
API
POST http://cm-0.tepper.cmu.edu:6000/v1/base64_embedding
Header={ authorization:convmind, Content-Type:application/json}
body={"sentences": ["This framework generates embeddings for each input sentence"]}
Python Code
import base64
import numpy as np
dfloat32 = np.dtype('>f4')
def decode_float_list(base64_string):
bytes = base64.b64decode(base64_string)
return np.frombuffer(bytes, dtype=dfloat32).tolist()
def encode_array(arr):
base64_str = base64.b64encode(np.array(arr).astype(dfloat32)).decode("utf-8")
return base64_str
Output
{"results":["Bc/V................"]}
POST http://cm-0.tepper.cmu.edu:6000/v1/similarity_search
Header={ authorization:convmind, Content-Type:application/json}
body={"corpus":["A man is eating a food.",
"A man is eating a piece of bread.",
"A man is eating pasta.",
"The girl is carrying a baby.",
"The baby is carried by the woman",
"A man is riding a horse.",
"A man is riding a white horse on an enclosed ground.",
"A monkey is playing drums.",
"Someone in a gorilla costume is playing a set of drums.",
"A cheetah is running behind its prey.",
"A cheetah chases prey on across a field."
],
"queries":["A man is eating pasta.", "Someone in a gorilla costume is playing a set of drums.", "A cheetah chases prey on across a field."]
}
Content type
Image
Digest
Size
5.8 GB
Last updated
over 6 years ago
docker pull kyusonglee/basic_nlp