BounWiki / static /script.js
LeoGitGuy
reqs
3de0849
raw
history blame contribute delete
639 Bytes
const textGenForm = document.querySelector('.text-gen-form');
const translateText = async (text) => {
const inferResponse = await fetch(`answer?input=${text}`);
const inferJson = await inferResponse.json();
console.log(inferJson.output)
return inferJson.output;
};
textGenForm.addEventListener('submit', async (event) => {
event.preventDefault();
const textGenInput = document.getElementById('text-gen-input');
const textGenParagraph = document.querySelector('.text-gen-output');
try {
textGenParagraph.textContent = await translateText(textGenInput.value);
} catch (err) {
console.error(err);
}
});