Spaces:
Sleeping
Sleeping
Download CV-Project/preprocess.py from Himel09/cv_project_test: direct link, hf CLI and curl.
- Browser
- Download file 521 Bytes
-
https://huggingface.co/spaces/Himel09/cv_project_test/resolve/main/CV-Project/preprocess.py
- Command line
-
hf download hf://spaces/Himel09/cv_project_test/CV-Project/preprocess.py
-
curl -L -o preprocess.py https://huggingface.co/spaces/Himel09/cv_project_test/resolve/main/CV-Project/preprocess.py
521 Bytes
| import os | |
| folder_path = r'D:\Microplastic_data' | |
| files = os.listdir(folder_path) | |
| files.sort() | |
| count = 1 | |
| for filename in files: | |
| if filename.lower().endswith(".jpg"): | |
| new_name = f"microplastic_{count}.jpg" | |
| old_file = os.path.join(folder_path, filename) | |
| new_file = os.path.join(folder_path, new_name) | |
| os.rename(old_file, new_file) | |
| print(f"Renamed: {filename} -> {new_name}") | |
| count += 1 | |
| print(f"\nDone!: Successfully renamed {count - 1} files.") |