diff --git a/modules/async_worker.py b/modules/async_worker.py index b2af671..67c2e70 100644 --- a/modules/async_worker.py +++ b/modules/async_worker.py @@ -40,7 +40,7 @@ def worker(): from modules.private_logger import log from extras.expansion import safe_str from modules.util import remove_empty_str, HWC3, resize_image, \ - get_image_shape_ceil, set_image_shape_ceil, get_shape_ceil, resample_image, erode_or_dilate + get_image_shape_ceil, set_image_shape_ceil, get_shape_ceil, resample_image, erode_or_dilate, ordinal_suffix from modules.upscaler import perform_upscale try: @@ -732,8 +732,7 @@ def worker(): done_steps = current_task_id * steps + step async_task.yields.append(['preview', ( int(15.0 + 85.0 * float(done_steps) / float(all_steps)), - f'Step {step}/{total_steps} in the {current_task_id + 1}-th Sampling', - y)]) + f'Step {step}/{total_steps} in the {current_task_id + 1}{ordinal_suffix(current_task_id + 1)} Sampling', y)]) for current_task_id, task in enumerate(tasks): execution_start_time = time.perf_counter() diff --git a/modules/util.py b/modules/util.py index de9bd5b..c309480 100644 --- a/modules/util.py +++ b/modules/util.py @@ -175,3 +175,7 @@ def get_files_from_folder(folder_path, exensions=None, name_filter=None): filenames.append(path) return filenames + + +def ordinal_suffix(number: int) -> str: + return 'th' if 10 <= number % 100 <= 20 else {1: 'st', 2: 'nd', 3: 'rd'}.get(number % 10, 'th')