diff --git a/environment.yaml b/environment.yaml index efd1039..d439c04 100644 --- a/environment.yaml +++ b/environment.yaml @@ -4,7 +4,6 @@ dependencies: - aiofiles>=22.1.0 - colorama>=0.4.5 - aiohttp>=3.8.3 - #- open_clip_torch>=1.26.12 - timm - fairscale==0.4.4 - transformers==4.19.2 diff --git a/scripts/filename_replace.py b/scripts/filename_replace.py index 5a648a7..c892a34 100644 --- a/scripts/filename_replace.py +++ b/scripts/filename_replace.py @@ -60,7 +60,7 @@ def get_replace_list(opt): def rename_files(opt): find_list = get_replace_list(opt) - for idx, file in glob.iglob(opt.img_dir + "/*"): + for idx, file in enumerate(glob.iglob(f"{opt.img_dir}/*")): print(file) if os.path.splitext(file)[1] in (".jpg", ".png", ".jpeg", ".gif", ".bmp", ".webp"): @@ -74,7 +74,7 @@ def rename_files(opt): try: print(f"Renaming {file} to {new_filename}") if os.path.exists(new_filename): - new_filename = new_filename + "_" + idx + new_filename = f"{new_filename}_{idx}" print(f"filename already exists, appended '_n' to {new_filename}") try: