diff --git a/ui/index.html b/ui/index.html
index dd1924b0..db393213 100644
--- a/ui/index.html
+++ b/ui/index.html
@@ -771,7 +771,7 @@ async function doMakeImage(reqBody, batchCount) {
if (stepUpdate.step === undefined) {
finalJSON += jsonStr
} else {
- let batchSize = parseInt(reqBody['num_inference_steps'])
+ let batchSize = stepUpdate.total_steps
let overallStepCount = stepUpdate.step + batchesDone * batchSize
let totalSteps = batchCount * batchSize
let percent = 100 * (overallStepCount / totalSteps)
diff --git a/ui/sd_internal/runtime.py b/ui/sd_internal/runtime.py
index 9fa88e5b..f03a0d34 100644
--- a/ui/sd_internal/runtime.py
+++ b/ui/sd_internal/runtime.py
@@ -369,7 +369,8 @@ def do_mk_img(req: Request):
partial_x_samples = x_samples
if req.stream_progress_updates:
- progress = {"step": i, "total_steps": opt_ddim_steps}
+ n_steps = opt_ddim_steps if req.init_image is None else t_enc
+ progress = {"step": i, "total_steps": n_steps}
if req.stream_image_progress and i % 5 == 0:
partial_images = []