okeowo1014 commited on
Commit
035a85c
1 Parent(s): 0ab4d04

Update train.py

Browse files
Files changed (1) hide show
  1. train.py +20 -9
train.py CHANGED
@@ -96,12 +96,23 @@ print('Test accuracy:', test_acc)
96
  # Show the model architecture
97
  model.summary()
98
 
99
- # Upload the model to your Hugging Face space repository
100
- push_to_hub_keras(
101
- model, # model, # Point to the SavedModel directory
102
- repo_id="okeowo1014/kerascatanddog.keras",
103
- commit_message="cats and dog image classifier with transfer learning",
104
- tags=["image-classifier", "data-augmentation", "class-weights"],
105
- include_optimizer=True,
106
- token=sac,
107
- )
 
 
 
 
 
 
 
 
 
 
 
 
96
  # Show the model architecture
97
  model.summary()
98
 
99
+ # # Upload the model to your Hugging Face space repository
100
+ # push_to_hub_keras(
101
+ # model, # model, # Point to the SavedModel directory
102
+ # repo_id="okeowo1014/kerascatanddog.keras",
103
+ # commit_message="cats and dog image classifier with transfer learning",
104
+ # tags=["image-classifier", "data-augmentation", "class-weights"],
105
+ # include_optimizer=True,
106
+ # token=sac,
107
+ # )
108
+ # Save the model with a valid extension (recommended: .h5)
109
+ model.save('cat_dog_classifierss.h5')
110
+
111
+ # Authenticate with Hugging Face (replace YOUR_TOKEN with your actual token)
112
+ from huggingface_hub import hf_hub_auth
113
+ hf_hub_auth(token=sac)
114
+
115
+ # Push the model to Hugging Face Hub with a descriptive name
116
+ model_repo = push_to_hub_keras(model, repo_name="okeowo1014/kerascatanddog") # Optional organization
117
+
118
+ print(f"Model pushed to Hugging Face Hub: {model_repo}")