Spaces:
Running on Zero
Running on Zero
Commit ·
fe3cc96
1
Parent(s): 4382eeb
Revert "Add step-progress bar to inference loader"
Browse filesThis reverts commit 4382eeb6464035463c7193a46a68a60305a37f82.
- app.py +0 -1
- static/app.css +1 -2
- static/wire_outputs.js +0 -72
app.py
CHANGED
|
@@ -361,7 +361,6 @@ def infer(images_b64_json, prompt, seed, randomize_seed, guidance_scale, steps,
|
|
| 361 |
delta_ms = (now - (_step_t[-2] if len(_step_t) > 1 else t0)) * 1000
|
| 362 |
tag = " ← includes compile" if step_idx == 0 else ""
|
| 363 |
print(f"[infer] step {step_idx+1}/{steps} done — {delta_ms:.0f}ms{tag} | {_gpu_mem_str(_cuda_ok)} | t={time.perf_counter()-t0:.1f}s")
|
| 364 |
-
progress((step_idx + 1) / steps, desc=f"Step {step_idx + 1}/{steps}")
|
| 365 |
return cb_kwargs
|
| 366 |
|
| 367 |
timer.mark("pipe_start")
|
|
|
|
| 361 |
delta_ms = (now - (_step_t[-2] if len(_step_t) > 1 else t0)) * 1000
|
| 362 |
tag = " ← includes compile" if step_idx == 0 else ""
|
| 363 |
print(f"[infer] step {step_idx+1}/{steps} done — {delta_ms:.0f}ms{tag} | {_gpu_mem_str(_cuda_ok)} | t={time.perf_counter()-t0:.1f}s")
|
|
|
|
| 364 |
return cb_kwargs
|
| 365 |
|
| 366 |
timer.mark("pipe_start")
|
static/app.css
CHANGED
|
@@ -267,9 +267,8 @@ body:not(.dark) #custom-run-btn *{color:#ffffff!important;-webkit-text-fill-colo
|
|
| 267 |
.modern-loader .loader-text{font-size:13px;color:#a1a1aa;font-weight:500}
|
| 268 |
.loader-bar-track{width:200px;height:4px;background:#4d0030;border-radius:2px;overflow:hidden}
|
| 269 |
.loader-bar-fill{
|
| 270 |
-
|
| 271 |
background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:2px;
|
| 272 |
-
transition:width 0.5s ease;
|
| 273 |
}
|
| 274 |
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
| 275 |
|
|
|
|
| 267 |
.modern-loader .loader-text{font-size:13px;color:#a1a1aa;font-weight:500}
|
| 268 |
.loader-bar-track{width:200px;height:4px;background:#4d0030;border-radius:2px;overflow:hidden}
|
| 269 |
.loader-bar-fill{
|
| 270 |
+
height:100%;background:linear-gradient(90deg,#ff0080,#ff4da6,#ff0080);
|
| 271 |
background-size:200% 100%;animation:shimmer 1.5s ease-in-out infinite;border-radius:2px;
|
|
|
|
| 272 |
}
|
| 273 |
@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
|
| 274 |
|
static/wire_outputs.js
CHANGED
|
@@ -96,76 +96,4 @@ function watchExampleResults() {
|
|
| 96 |
setInterval(checkResult, 500);
|
| 97 |
}
|
| 98 |
watchExampleResults();
|
| 99 |
-
|
| 100 |
-
function watchProgress() {
|
| 101 |
-
function setProgress(fraction) {
|
| 102 |
-
const fill = document.querySelector('.loader-bar-fill');
|
| 103 |
-
const text = document.querySelector('.loader-text');
|
| 104 |
-
if (fill) fill.style.width = Math.min(fraction * 100, 100).toFixed(1) + '%';
|
| 105 |
-
if (text) text.textContent = `Step ${Math.round(fraction * 100)}%`;
|
| 106 |
-
}
|
| 107 |
-
|
| 108 |
-
function scanGradioProgress() {
|
| 109 |
-
const pli = document.querySelector('.progress-level-inner');
|
| 110 |
-
if (pli && pli.style.width) {
|
| 111 |
-
const w = parseFloat(pli.style.width);
|
| 112 |
-
if (!isNaN(w) && w > 0) { setProgress(w / 100); return; }
|
| 113 |
-
}
|
| 114 |
-
const pb = document.querySelector('[role="progressbar"]');
|
| 115 |
-
if (pb) {
|
| 116 |
-
const val = parseFloat(pb.getAttribute('aria-valuenow'));
|
| 117 |
-
const max = parseFloat(pb.getAttribute('aria-valuemax') || '100');
|
| 118 |
-
if (!isNaN(val) && val > 0) { setProgress(val / max); return; }
|
| 119 |
-
}
|
| 120 |
-
const pg = document.querySelector('progress');
|
| 121 |
-
if (pg && pg.max && pg.value > 0) { setProgress(pg.value / pg.max); }
|
| 122 |
-
}
|
| 123 |
-
|
| 124 |
-
let progressObs = null;
|
| 125 |
-
|
| 126 |
-
function startObs() {
|
| 127 |
-
if (progressObs) progressObs.disconnect();
|
| 128 |
-
progressObs = new MutationObserver(scanGradioProgress);
|
| 129 |
-
progressObs.observe(document.body, {
|
| 130 |
-
childList: true, subtree: true,
|
| 131 |
-
attributes: true, attributeFilter: ['style', 'aria-valuenow', 'value'],
|
| 132 |
-
});
|
| 133 |
-
}
|
| 134 |
-
|
| 135 |
-
function stopObs() {
|
| 136 |
-
if (progressObs) { progressObs.disconnect(); progressObs = null; }
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
function init() {
|
| 140 |
-
if (!window.__clickGradioRunBtn || !window.__hideLoader) {
|
| 141 |
-
setTimeout(init, 250);
|
| 142 |
-
return;
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
const origRun = window.__clickGradioRunBtn;
|
| 146 |
-
window.__clickGradioRunBtn = function() {
|
| 147 |
-
const fill = document.querySelector('.loader-bar-fill');
|
| 148 |
-
const text = document.querySelector('.loader-text');
|
| 149 |
-
if (fill) fill.style.width = '0%';
|
| 150 |
-
if (text) text.textContent = 'Processing image...';
|
| 151 |
-
startObs();
|
| 152 |
-
origRun();
|
| 153 |
-
};
|
| 154 |
-
|
| 155 |
-
const origHide = window.__hideLoader;
|
| 156 |
-
window.__hideLoader = function() {
|
| 157 |
-
stopObs();
|
| 158 |
-
const fill = document.querySelector('.loader-bar-fill');
|
| 159 |
-
const text = document.querySelector('.loader-text');
|
| 160 |
-
if (fill) fill.style.width = '100%';
|
| 161 |
-
if (text) text.textContent = 'Done!';
|
| 162 |
-
setTimeout(() => {
|
| 163 |
-
origHide();
|
| 164 |
-
if (text) text.textContent = 'Processing image...';
|
| 165 |
-
}, 400);
|
| 166 |
-
};
|
| 167 |
-
}
|
| 168 |
-
init();
|
| 169 |
-
}
|
| 170 |
-
watchProgress();
|
| 171 |
}
|
|
|
|
| 96 |
setInterval(checkResult, 500);
|
| 97 |
}
|
| 98 |
watchExampleResults();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
}
|