@@ -157,6 +157,7 @@ const std::string html_content = R"xxx(
157
157
height: 100%;
158
158
}
159
159
.imageFrame {
160
+ margin-top: auto;
160
161
border: 1px solid #ccc;
161
162
width: 512px;
162
163
height: 512px;
@@ -176,12 +177,30 @@ const std::string html_content = R"xxx(
176
177
.left-section,
177
178
.right-section {
178
179
width: 50%;
180
+ height: 100%;
179
181
}
180
182
.imageFrame {
181
183
max-width: 45vw;
182
184
max-height: 45vw;
183
185
}
184
186
}
187
+ progress {
188
+ border: none;
189
+ width: 100%;
190
+ height: 8px;
191
+ margin-inline: auto;
192
+ }
193
+ progress::-webkit-progress-value {
194
+ background-color: blue;
195
+ }
196
+ .bars {
197
+ margin-bottom: 10%;
198
+ height: max-content;
199
+ display: flex;
200
+ width: 80%;
201
+ flex-direction: column;
202
+ margin-top: auto;
203
+ }
185
204
</style>
186
205
</head>
187
206
)xxx"
@@ -350,7 +369,11 @@ R"xxx(
350
369
<canvas id="imageCanvas" width="512" height="512"></canvas>
351
370
</div>
352
371
<a id="downloadLink" style="display: none;" download="generated_image.png">Download Image</a>
353
- <progress style="display: none;" id="progress" value="0" max="100"> 0% </progress>
372
+ <div class="bars">
373
+ <progress id="load_progress" value="0" max="100"> 0% </progress>
374
+ <progress id="work_progress" value="0" max="100"> 0% </progress>
375
+ <progress id="vae_progress" value="0" max="100"> 0% </progress>
376
+ </div>
354
377
</div>
355
378
</div>
356
379
<div class="status">
@@ -642,16 +665,12 @@ R"xxx(
642
665
const data = await response.json();
643
666
const taskId = data.task_id;
644
667
let status = 'Pending';
645
- const progressBar = document.getElementById("progress");
646
668
while (status !== 'Done' && status !== 'Failed') {
647
669
const statusResponse = await fetch(`/result?task_id=${taskId}`);
648
670
const statusData = await statusResponse.json();
649
671
if (status == 'Pending' && statusData.status != status) {
650
- //Task has started, update
651
672
setTimeout(() => {
652
673
fetchModelId();
653
- // Updating params can be annoying, let's just hope they are taken into account
654
- // fetchParams();
655
674
const modelsSelect = document.getElementById('model');
656
675
const diffModelsSelect = document.getElementById('diff-model');
657
676
const clipLSelect = document.getElementById('clip_l');
@@ -666,12 +685,23 @@ R"xxx(
666
685
t5xxlSelect.selectedIndex = 0;
667
686
vaeSelect.selectedIndex = 0;
668
687
taeSelect.selectedIndex = 0;
688
+ document.getElementById("load_progress").value = 0;
689
+ document.getElementById("work_progress").value = 0;
690
+ document.getElementById("vae_progress").value = 0;
669
691
}, 0);
670
692
}
671
693
status = statusData.status;
694
+ if (status !== "Pending" && status !== "Loading") {
695
+ const progressBar = document.getElementById("load_progress");
696
+ progressBar.value = 1;
697
+ progressBar.max = 1;
698
+ progressBar.innerHTML = "100%";
699
+ progressBar.style.display = 'inline-block';
700
+ }
701
+ const progressBar = status === "Loading" ? document.getElementById("load_progress") : status === "Working" ? document.getElementById("work_progress") : document.getElementById("vae_progress");
672
702
document.getElementById('status').innerHTML = status;
673
- if (statusData.step >= 0) {
674
- progressBar.value = statusData.step;
703
+ if (status !== 'Done' && statusData.step >= 0) {
704
+ progressBar.value = statusData.step;
675
705
progressBar.max = statusData.steps ?? steps;
676
706
progressBar.innerHTML = Math.floor(100 * statusData.step / statusData.steps) + "%";
677
707
progressBar.style.display = 'inline-block';
@@ -706,10 +736,11 @@ R"xxx(
706
736
} else if (status === 'Failed') {
707
737
alert('Image generation failed');
708
738
}
709
- await new Promise(resolve => setTimeout(resolve, 250 ));
739
+ await new Promise(resolve => setTimeout(resolve, 100 ));
710
740
}
711
- progressBar.value = steps;
712
- progressBar.innerHTML = "100%";
741
+ document.getElementById("load_progress").value = document.getElementById("load_progress").max;
742
+ document.getElementById("work_progress").value = document.getElementById("work_progress").max;
743
+ document.getElementById("vae_progress").value = document.getElementById("vae_progress").max;
713
744
queued_tasks--;
714
745
update_queue();
715
746
}
0 commit comments