xxxxxxxxxx
28
function setup() {
noCanvas();
getData();
async function getData() {
console.log('making request');
const API_KEY = '_________';
let data = {
inputs: "I took the lift to my flat?",
options: {
wait_for_model: true,
},
};
const response = await fetch(
"https://api-inference.huggingface.co/models/Helsinki-NLP/opus-tatoeba-en-tr",
{
method: "POST",
body: JSON.stringify(data),
headers: {
Authorization: `Bearer ${API_KEY}`,
},
}
);
const result = await response.json();
console.log(result);
}
}