API_URL = “https://huggingface.co/proxy/router.huggingface.co/hf-inference/models/sentence-transformers/LaBSE/pipeline/feature-extraction”
headers = {
“Authorization”: “Bearer HF_TOKEN”,
}
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
return response.json()
output = query({
“inputs”: {
“sentences”: [
“That is a happy dog”,
“That is a very happy person”,
“Today is a sunny da”
]
},
})
print(output)
So from the example code given on the model page “view code snippets”, just changing /pipeline/sentence-similarity for /pipeline/feature-extraction and removing the source_sentence from the query, results in an output of embeddings for me.