|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>Document</title> |
|
</head> |
|
<body> |
|
Hello world! |
|
<div id="res"></div> |
|
|
|
|
|
<script> |
|
console.log("started") |
|
|
|
papers = [ |
|
{'title': 'BERT', 'abstract': 'We introduce a new language representation model called BERT'}, |
|
{'title': 'Attention is all you need', 'abstract': ' The dominant sequence transduction models are based on complex recurrent or convolutional neural networks'} |
|
] |
|
|
|
async function getSimilarity(papers) { |
|
const request = { papers } |
|
const response = await fetch('similarity', { |
|
method: 'POST', |
|
headers: { |
|
'Accept': 'application/json', |
|
'Content-Type': 'application/json' |
|
}, |
|
body: JSON.stringify(request) |
|
}); |
|
|
|
const content = await response.json(); |
|
console.log(content) |
|
document.querySelector("#res").innerHTML = content.toString() |
|
return content['output'] |
|
} |
|
|
|
|
|
|
|
getSimilarity(papers) |
|
|
|
</script> |
|
</body> |
|
</html> |