Spaces:
Sleeping
Sleeping
File size: 1,371 Bytes
dbbf6be 2519913 dbbf6be 16ea59d dbbf6be 16ea59d dbbf6be 16ea59d dbbf6be 16ea59d dbbf6be 16ea59d dbbf6be 16ea59d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | const textGenFormT5 = document.querySelector(".text-gen-form-t5");
const translateTextT5 = async (text) => {
const inferResponseT5 = await fetch(`infer_t5?input=${text}`);
const inferJson = await inferResponseT5.json();
return inferJson.output;
};
textGenFormT5.addEventListener("submit", async (event) => {
event.preventDefault();
const textGenInputT5 = document.getElementById("text-gen-input-t5");
const textGenParagraphT5 = document.querySelector(".text-gen-output-t5");
// textGenParagraphT5.textContent = await translateTextT5(textGenInputT5.value);
try {
textGenParagraphT5.textContent = await translateText(textGenInputT5.value);
} catch (err) {
console.error(err);
}
});
// const textGenFormLlama = document.querySelector(".text-gen-form-llama2");
// const translateTextLlama = async (text) => {
// const inferResponse = await fetch(`llama2_generate?input=${text}`);
// const inferJson = await inferResponse.json();
// return inferJson.output;
// };
// textGenFormLlama.addEventListener("submit", async (event) => {
// event.preventDefault();
// const textGenInputLlama2 = document.getElementById("text-gen-input-llama2");
// const textGenParagraphLlama2 = document.querySelector(".text-gen-output-llama2");
// textGenParagraphLlama2.textContent = await translateTextLlama(textGenInputLlama2.value);
// }); |