    const file = fileInput.files[0];

            if (file) {
                formData.append('image', file);

                // Perform the image upload via Fetch API
                fetch('http://127.0.0.1:5000/upload', {
                    method: 'POST',
                    body: formData
                })
                .then(response => response.blob()) // Get the image as a Blob from the response
                .then(imageBlob => {
                    const imageObjectURL = URL.createObjectURL(i