<!-- Load TensorFlow.js. This is required to use the qna model. --> <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"> </script> <!-- Load the qna model. --> <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/qna"> </script> <!-- Place your code in the script tag below. You can also use an external .js file --> <script> // Notice there is no 'import' statement. 'qna' and 'tf' is // available on the index-page because of the script tag above. // Load the model. qna.load().then(model => { model.findAnswers(question, passage).then(answers => { console.log('Answers: ', answers); }); }); </script>
[ { text: string, score: number, startIndex: number, endIndex: number } ]