Spaces:
Sleeping
Sleeping
File size: 713 Bytes
6583a12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | async function humanize() {
const input = document.getElementById("inputText").value;
const outputArea = document.getElementById("outputText");
outputArea.value = "Processing...";
const response = await fetch("https://api-inference.huggingface.co/models/google/flan-t5-base", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_HUGGINGFACE_API_TOKEN", // Replace with real token
"Content-Type": "application/json"
},
body: JSON.stringify({
inputs: `Humanize this: ${input}`
})
});
const result = await response.json();
if (result.error) {
outputArea.value = "Error: " + result.error;
} else {
outputArea.value = result[0].generated_text;
}
} |