Spaces:
Running
Running
Download k.py from kshitiz14/breedclassification: direct link, hf CLI and curl.
- Browser
- Download file 561 Bytes
-
https://huggingface.co/spaces/kshitiz14/breedclassification/resolve/main/k.py
- Command line
-
hf download hf://spaces/kshitiz14/breedclassification/k.py
-
curl -L -o k.py https://huggingface.co/spaces/kshitiz14/breedclassification/resolve/main/k.py
561 Bytes
| import json | |
| from tensorflow.keras.preprocessing.image import ImageDataGenerator | |
| IMG_SIZE = (224,224) | |
| datagen = ImageDataGenerator(rescale=1./255, validation_split=0.2) | |
| # Use same folder you trained with | |
| generator = datagen.flow_from_directory( | |
| "d:/SIH/images", | |
| target_size=IMG_SIZE, | |
| batch_size=32, | |
| class_mode="categorical", | |
| subset="training" | |
| ) | |
| # Save class indices | |
| with open("class_indices.json", "w") as f: | |
| json.dump(generator.class_indices, f) | |
| print("✅ Class indices saved as class_indices.json") | |
| print(generator.class_indices) | |