okeowo1014 commited on
Commit
1961dc6
1 Parent(s): 789498c

Update train.py

Browse files
Files changed (1) hide show
  1. train.py +5 -4
train.py CHANGED
@@ -106,13 +106,14 @@ model.summary()
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_id="okeowo1014/kerascatanddog",token=sac) # Optional organization
117
 
118
  print(f"Model pushed to Hugging Face Hub: {model_repo}")
 
106
  # token=sac,
107
  # )
108
  # Save the model with a valid extension (recommended: .h5)
109
+ model.save('cat_dog_classifierss.h5','',save_format='tf',)
110
+ # tf.keras.models.save_model(model, 'cat_dog_classifierss.keras')
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
+ # Recreate the exact same model purely from the file
115
+ new_model = keras.models.load_model('path_to_my_model')
116
  # Push the model to Hugging Face Hub with a descriptive name
117
+ model_repo = push_to_hub_keras(new_model, repo_id="okeowo1014/kerascatanddog",token=sac) # Optional organization
118
 
119
  print(f"Model pushed to Hugging Face Hub: {model_repo}")