Update static/index.html
Browse files- static/index.html +20 -19
static/index.html
CHANGED
@@ -406,13 +406,12 @@
|
|
406 |
|
407 |
</div>
|
408 |
<div id="resultImage">
|
409 |
-
|
410 |
<div id="loadingSpinner" style="display: none;"></div>
|
411 |
<div id="resultContainer">
|
412 |
-
<p>Your Generated Image Will Appear Here</p>
|
|
|
413 |
</div>
|
414 |
-
|
415 |
-
|
416 |
|
417 |
|
418 |
|
@@ -470,26 +469,27 @@
|
|
470 |
// Display loading spinner
|
471 |
const loadingSpinner = document.getElementById('loadingSpinner');
|
472 |
showSpinner('loadingSpinner');
|
|
|
|
|
473 |
|
474 |
-
|
475 |
-
|
|
|
476 |
|
477 |
-
|
478 |
-
throw new Error('Network response was not ok');
|
479 |
-
}
|
480 |
|
481 |
-
|
|
|
482 |
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
resultContainer.innerHTML = `<p style="color: white;">Oops! Something went wrong. Please try again later.</p>`;
|
491 |
}
|
492 |
-
|
493 |
|
494 |
|
495 |
|
@@ -538,3 +538,4 @@ function toggleAdvancedOptions() {
|
|
538 |
</script>
|
539 |
</body>
|
540 |
</html>
|
|
|
|
406 |
|
407 |
</div>
|
408 |
<div id="resultImage">
|
|
|
409 |
<div id="loadingSpinner" style="display: none;"></div>
|
410 |
<div id="resultContainer">
|
411 |
+
<p>Your Generated Image Will Appear Here</p>
|
412 |
+
</div>
|
413 |
</div>
|
414 |
+
|
|
|
415 |
|
416 |
|
417 |
|
|
|
469 |
// Display loading spinner
|
470 |
const loadingSpinner = document.getElementById('loadingSpinner');
|
471 |
showSpinner('loadingSpinner');
|
472 |
+
try {
|
473 |
+
const response = await fetch(`/send_inputs?inputs=${encodeURIComponent(inputs)}&noise_level=${noiseLevel}&is_negative=${isNegative}&steps=${steps}&cfg_scale=${cfgScale}&seed=${seed}`);
|
474 |
|
475 |
+
if (!response.ok) {
|
476 |
+
throw new Error('Network response was not ok');
|
477 |
+
}
|
478 |
|
479 |
+
const data = await response.json();
|
|
|
|
|
480 |
|
481 |
+
// Hide loading spinner
|
482 |
+
hideSpinner('loadingSpinner');
|
483 |
|
484 |
+
// Display the result image
|
485 |
+
const resultImage = document.getElementById('resultContainer');
|
486 |
+
resultImage.innerHTML = `<img src="${data.image_url}" alt="Generated Image">`;
|
487 |
+
} catch (error) {
|
488 |
+
console.error('Error:', error);
|
489 |
+
resultContainer.innerHTML = `<p style="color: white;">Oops! Something went wrong. Please try again later.</p>`;
|
490 |
+
}
|
|
|
491 |
}
|
492 |
+
|
493 |
|
494 |
|
495 |
|
|
|
538 |
</script>
|
539 |
</body>
|
540 |
</html>
|
541 |
+
|