aineid / static /script.js
grosenthal's picture
fix perms
ef003ce
raw
history blame contribute delete
No virus
553 Bytes
const textGenForm = document.querySelector(".text-gen-form");
const translateText = async (text) => {
const inferResponse = await fetch(`process?text=${text}`);
const inferJson = await inferResponse.json();
return inferJson;
};
textGenForm.addEventListener("submit", async (event) => {
event.preventDefault();
const textGenInput = document.getElementById("text-gen-input");
const textGenParagraph = document.querySelector(".text-gen-output");
textGenParagraph.textContent = await translateText(textGenInput.value);
});