Create script.js
Browse files- static/script.js +30 -0
static/script.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
//const textGenForm = document.querySelector('.text-gen-form');
|
| 2 |
+
//
|
| 3 |
+
//const 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 |
+
//
|
| 10 |
+
//textGenForm.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 |
+
// try {
|
| 17 |
+
// textGenParagraph.textContent = await translateText(textGenInput.value);
|
| 18 |
+
// } catch (err) {
|
| 19 |
+
// console.error(err);
|
| 20 |
+
// }
|
| 21 |
+
//});
|
| 22 |
+
|
| 23 |
+
document.addEventListener("DOMContentLoaded", () => {
|
| 24 |
+
const uploadForm = document.querySelector(".image-upload-form");
|
| 25 |
+
const uploadButton = document.querySelector("#image-upload-submit");
|
| 26 |
+
|
| 27 |
+
uploadButton.addEventListener("click", () => {
|
| 28 |
+
uploadForm.submit();
|
| 29 |
+
});
|
| 30 |
+
});
|