Spaces:
Sleeping
Sleeping
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Similarity</title> | |
</head> | |
<body> | |
<h1>{{ sourcetxt }} </h1> | |
</ul> | |
<script> | |
document.addEventListener("DOMContentLoaded", function() { | |
async function query(data) { | |
const response = await fetch( | |
"https://api-inference.huggingface.co/models/sentence-transformers/all-MiniLM-L6-v2", | |
{ | |
headers: { | |
Authorization: "{{ headertxt }}", | |
"Content-Type": "application/json", | |
}, | |
method: "POST", | |
body: JSON.stringify(data), | |
} | |
); | |
const result = await response.json(); | |
return result; | |
} | |
query({"inputs": { | |
"source_sentence": "That is a happy person", | |
"sentences": [ | |
"That is a happy dog", | |
"That is a very happy person", | |
"Today is a sunny day" | |
] | |
}}).then((response) => { | |
console.log("async callback") | |
console.log(JSON.stringify(response)); | |
}); | |
});//document ready | |
</script> | |
</body> | |
</html> | |