BitBasher/EduConnect
1
1const textGenForm = document.querySelector(".text-gen-form");2 3const translateText = async (text) => {4 const inferResponse = await fetch(`infer_t5?input=${text}`);5 const inferJson = await inferResponse.json();6 7 return inferJson.output;8};9 10textGenForm.addEventListener("submit", async (event) => {11 event.preventDefault();12 13 const textGenInput = document.getElementById("text-gen-input");14 const textGenParagraph = document.querySelector(".text-gen-output");15 16 textGenParagraph.textContent = await translateText(textGenInput.value);17});