Update image_captioner.py

This commit is contained in:
AIExplorer
2025-06-08 01:19:36 +05:30
committed by GitHub
parent 9591fdcffc
commit e5a8dfb5f3
+2 -2
View File
@@ -45,7 +45,7 @@ class ImageCaptioner:
print("inside rename image if ...")
for i, image_name in enumerate(os.listdir(image_folder_path)):
if image_name.endswith(".JPG") or image_name.endswith(".jpg") or image_name.endswith(".png") or image_name.endswith(".jpeg"):
new_image_name = f"{i+1}.jpg"
new_image_name = f"{i}.jpg"
os.rename(os.path.join(image_folder_path, image_name), os.path.join(image_folder_path, new_image_name))
print(f"Renamed {image_name} to {new_image_name}")
else:
@@ -53,7 +53,7 @@ class ImageCaptioner:
print("inside rename image else ...")
for i, image_name in enumerate(os.listdir(image_folder_path)):
if image_name.endswith(".JPG") or image_name.endswith(".jpg") or image_name.endswith(".png") or image_name.endswith(".jpeg"):
new_image_name = f"{i+1}.jpg"
new_image_name = f"{i}.jpg"
os.rename(os.path.join(image_folder_path, image_name), os.path.join(image_folder_path, new_image_name))
print(f"Renamed {image_name} to {new_image_name}")
# Load the model and processor