mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
feat: add suffix ordinals (#845)
* add suffix ordinals with lambda * delay importing of modules.config (#2195) * refactor: use easier to read version to find matching ordinal suffix --------- Co-authored-by: rsl8 <138326583+rsl8@users.noreply.github.com> Co-authored-by: Manuel Schmid <manuel.schmid@odt.net> Co-authored-by: Manuel Schmid <9307310+mashb1t@users.noreply.github.com>
This commit is contained in:
co-authored by
rsl8
Manuel Schmid
Manuel Schmid
parent
b9d7e77b0d
commit
eb3f4d745c
@@ -40,7 +40,7 @@ def worker():
|
|||||||
from modules.private_logger import log
|
from modules.private_logger import log
|
||||||
from extras.expansion import safe_str
|
from extras.expansion import safe_str
|
||||||
from modules.util import remove_empty_str, HWC3, resize_image, \
|
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
|
from modules.upscaler import perform_upscale
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -732,8 +732,7 @@ def worker():
|
|||||||
done_steps = current_task_id * steps + step
|
done_steps = current_task_id * steps + step
|
||||||
async_task.yields.append(['preview', (
|
async_task.yields.append(['preview', (
|
||||||
int(15.0 + 85.0 * float(done_steps) / float(all_steps)),
|
int(15.0 + 85.0 * float(done_steps) / float(all_steps)),
|
||||||
f'Step {step}/{total_steps} in the {current_task_id + 1}-th Sampling',
|
f'Step {step}/{total_steps} in the {current_task_id + 1}{ordinal_suffix(current_task_id + 1)} Sampling', y)])
|
||||||
y)])
|
|
||||||
|
|
||||||
for current_task_id, task in enumerate(tasks):
|
for current_task_id, task in enumerate(tasks):
|
||||||
execution_start_time = time.perf_counter()
|
execution_start_time = time.perf_counter()
|
||||||
|
|||||||
@@ -175,3 +175,7 @@ def get_files_from_folder(folder_path, exensions=None, name_filter=None):
|
|||||||
filenames.append(path)
|
filenames.append(path)
|
||||||
|
|
||||||
return filenames
|
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')
|
||||||
|
|||||||
Reference in New Issue
Block a user