diff --git a/neural_style_app/static/sciana.jpg b/neural_style_app/static/sciana.jpg new file mode 100644 index 0000000..fcf26da Binary files /dev/null and b/neural_style_app/static/sciana.jpg differ diff --git a/neural_style_app/templates/index.html b/neural_style_app/templates/index.html index f1b8bc8..92f32b3 100644 --- a/neural_style_app/templates/index.html +++ b/neural_style_app/templates/index.html @@ -5,17 +5,92 @@ Style Transfer @@ -23,19 +98,25 @@

Style Transfer

-

+ -

+
+ +
Processing images, please wait...
+

Resulting Image:

+ + +
Generating visualization, please wait...
@@ -44,6 +125,10 @@ document.getElementById('upload-form').addEventListener('submit', async function(event) { event.preventDefault(); // Prevent the form from submitting the traditional way + // Show the loading message + const loadingMessage = document.getElementById('loading-message'); + loadingMessage.style.display = 'block'; + const formData = new FormData(this); const response = await fetch('/', { @@ -63,16 +148,26 @@ const resultContainer = document.getElementById('result-container'); resultContainer.style.display = 'block'; // Show the container + + // Hide the loading message + loadingMessage.style.display = 'none'; } }); // JavaScript to handle visualization button click document.getElementById('visualize-btn').addEventListener('click', async function() { + // Show the loading message + const visualizeLoadingMessage = document.getElementById('visualize-loading-message'); + visualizeLoadingMessage.style.display = 'block'; + const response = await fetch('/visualize'); if (response.ok) { const visualizationContainer = document.getElementById('visualization-container'); visualizationContainer.innerHTML = await response.text(); // Display the plot + + // Hide the loading message + visualizeLoadingMessage.style.display = 'none'; } });