async function humanize() { const input = document.getElementById("inputText").value; const outputArea = document.getElementById("outputText"); outputArea.value = "Processing..."; try { const response = await fetch("/humanize", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ input: input }) }); const result = await response.json(); outputArea.value = result[0]?.generated_text || "Error: Unexpected response."; } catch (err) { outputArea.value = "Request failed: " + err.message; } }