Spaces:
Runtime error
Runtime error
const textGenForm = document.querySelector('.text-gen-form'); | |
const translateText = async (text) => { | |
const inferResponse = await fetch(`infer_t5?input=${text}`); | |
const inferJson = await inferResponse.json(); | |
return inferJson.output; | |
}; | |
textGenForm.addEventListener('submit', async (event) => { | |
event.preventDefault(); | |
const textGenInput = document.getElementById('text-gen-input'); | |
const textGenParagraph = document.querySelector('.text-gen-output'); | |
try { | |
textGenParagraph.textContent = await translateText(textGenInput.value); | |
} catch (err) { | |
console.error(err); | |
} | |
}); | |
function submitImages(acceptedFiles) { | |
const data = new FormData(); | |
for (const file of acceptedFiles){ | |
data.append('files[]', file, file.name); | |
} | |
// classifyResponse = fetch('classify', { | |
// method: 'POST', | |
// body: data | |
// }); | |
return "aqa"; | |
} | |
const inputImg = document.querySelector('.img-input'); | |
const outputImg = document.querySelector('.img-output'); | |
let imageArray = []; | |
inputImg.addEventListener("change", event =>{ | |
const files = event.target.files; | |
res = "aaa" | |
res = submitImages(files); | |
console.log(res); | |
outputImg.textContent = "Result is: " + res; | |
}); | |
const classifyBtn = document.querySelector('.classify-btn'); | |
const outputPar = document.querySelector('.test-output'); | |
classifyBtn.addEventListener('onclick', () => { | |
outputPar.textContent = "asa"; | |
}); |