Ashrafb commited on
Commit
cead89b
1 Parent(s): 7a651f2

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +3 -5
static/index.html CHANGED
@@ -463,9 +463,6 @@ function sendInputs() {
463
  const steps = document.getElementById("steps").value;
464
  const cfgScale = document.getElementById("cfg_scale").value;
465
  const seed = document.getElementById("seed").value;
466
-
467
- const imageBox = document.getElementById("image-box"); // Moved the imageBox variable declaration here
468
-
469
  fetch(`/send_inputs?inputs=${encodeURIComponent(inputs)}&noise_level=${noiseLevel}&is_negative=${isNegative}&steps=${steps}&cfg_scale=${cfgScale}&seed=${seed}`)
470
  .then(response => {
471
  if (!response.ok) {
@@ -474,6 +471,7 @@ function sendInputs() {
474
  return response.json();
475
  })
476
  .then(data => {
 
477
  const img = new Image();
478
  img.src = 'data:image/jpeg;base64,' + data.image_base64;
479
  const maxWidth = 200;
@@ -483,12 +481,12 @@ function sendInputs() {
483
  img.width *= ratio;
484
  img.height *= ratio;
485
  }
486
- imageBox.innerHTML = ""; // Clear previous content
487
- imageBox.appendChild(img); // Append new image
488
  hideSpinner('sendSpinner');
489
  })
490
  .catch(error => {
491
  console.error('Error:', error);
 
492
  imageBox.innerHTML = "<p>An error occurred. Please try again later.</p>";
493
  hideSpinner('sendSpinner');
494
  });
 
463
  const steps = document.getElementById("steps").value;
464
  const cfgScale = document.getElementById("cfg_scale").value;
465
  const seed = document.getElementById("seed").value;
 
 
 
466
  fetch(`/send_inputs?inputs=${encodeURIComponent(inputs)}&noise_level=${noiseLevel}&is_negative=${isNegative}&steps=${steps}&cfg_scale=${cfgScale}&seed=${seed}`)
467
  .then(response => {
468
  if (!response.ok) {
 
471
  return response.json();
472
  })
473
  .then(data => {
474
+ const imageBox = document.getElementById("image-box");
475
  const img = new Image();
476
  img.src = 'data:image/jpeg;base64,' + data.image_base64;
477
  const maxWidth = 200;
 
481
  img.width *= ratio;
482
  img.height *= ratio;
483
  }
484
+ imageBox.appendChild(img);
 
485
  hideSpinner('sendSpinner');
486
  })
487
  .catch(error => {
488
  console.error('Error:', error);
489
+ const imageBox = document.getElementById("image-box");
490
  imageBox.innerHTML = "<p>An error occurred. Please try again later.</p>";
491
  hideSpinner('sendSpinner');
492
  });