diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-05-09 22:40:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-09 22:40:51 +0300 |
commit | d6a9b22c195a0b4b9c6b04ccdfc59c18d099da7a (patch) | |
tree | 894f00b92caa229dbfaa2d07c16c25e0167412db /modules/textual_inversion/preprocess.py | |
parent | ccbb361845bfabfa3fc2c77bb234ea4be0781dd9 (diff) | |
parent | 3ba6c3c83c0983a025c7bddc08bb7f49481b3cbb (diff) |
Merge pull request #10232 from akx/eff
Fix up string formatting/concatenation to f-strings where feasible
Diffstat (limited to 'modules/textual_inversion/preprocess.py')
-rw-r--r-- | modules/textual_inversion/preprocess.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/textual_inversion/preprocess.py b/modules/textual_inversion/preprocess.py index 4a29151d..da0bcb26 100644 --- a/modules/textual_inversion/preprocess.py +++ b/modules/textual_inversion/preprocess.py @@ -63,9 +63,9 @@ def save_pic_with_caption(image, index, params: PreprocessParams, existing_capti image.save(os.path.join(params.dstdir, f"{basename}.png"))
if params.preprocess_txt_action == 'prepend' and existing_caption:
- caption = existing_caption + ' ' + caption
+ caption = f"{existing_caption} {caption}"
elif params.preprocess_txt_action == 'append' and existing_caption:
- caption = caption + ' ' + existing_caption
+ caption = f"{caption} {existing_caption}"
elif params.preprocess_txt_action == 'copy' and existing_caption:
caption = existing_caption
@@ -174,7 +174,7 @@ def preprocess_work(process_src, process_dst, process_width, process_height, pre params.src = filename
existing_caption = None
- existing_caption_filename = os.path.splitext(filename)[0] + '.txt'
+ existing_caption_filename = f"{os.path.splitext(filename)[0]}.txt"
if os.path.exists(existing_caption_filename):
with open(existing_caption_filename, 'r', encoding="utf8") as file:
existing_caption = file.read()
|