function scanImage() {
const file = document.getElementById('image-input').files[0];
if (!file) {
alert('Please select an image.');
return;
}
Tesseract.recognize(
file,
'eng', // Set the language, for example English
{
logger: info => console.log(info) // For logging progress
}
).then(({ data: { text } }) => {
document.getElementById('output').innerText = 'Scanned Question: ' + text;
// Here you can send the text to your math solver API
}).catch(err => {
console.error('Error:', err);
alert('An error occurred during scanning.');
});
}