Spaces:
Sleeping
Sleeping
Download scripts/data_prep/fix_dataset.py from Kurtgitgit/mission17-ai: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/Kurtgitgit/mission17-ai/resolve/main/scripts/data_prep/fix_dataset.py
- Command line
-
hf download hf://spaces/Kurtgitgit/mission17-ai/scripts/data_prep/fix_dataset.py
-
curl -L -o fix_dataset.py https://huggingface.co/spaces/Kurtgitgit/mission17-ai/resolve/main/scripts/data_prep/fix_dataset.py
1.01 kB
| import os | |
| import shutil | |
| # Define paths | |
| import os | |
| base_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'dataset', 'garbage_classification') | |
| old_planting = os.path.join(base_dir, "planting") | |
| new_planting = os.path.join(base_dir, "SDG13_15_Planting") | |
| # Create new folder if it doesn't exist | |
| if not os.path.exists(new_planting): | |
| os.makedirs(new_planting) | |
| # Move files from Old -> New | |
| if os.path.exists(old_planting): | |
| print(f"🔄 Moving files from '{old_planting}' to '{new_planting}'...") | |
| files = os.listdir(old_planting) | |
| for file in files: | |
| old_path = os.path.join(old_planting, file) | |
| new_path = os.path.join(new_planting, f"old_{file}") # Rename to avoid conflicts | |
| shutil.move(old_path, new_path) | |
| # Delete the empty old folder | |
| os.rmdir(old_planting) | |
| print("✅ Successfully merged folders!") | |
| print("🗑️ Deleted old 'planting' folder.") | |
| else: | |
| print("⚠️ Old 'planting' folder not found. Already merged?") |