okeowo1014 commited on
Commit
1990fd1
1 Parent(s): dda3659

Update tr.py

Browse files
Files changed (1) hide show
  1. tr.py +3 -3
tr.py CHANGED
@@ -36,11 +36,11 @@ model.fit(X_train, y_train, epochs=5, batch_size=2)
36
  loss, accuracy = model.evaluate(X_test, y_test)
37
  print(f'Accuracy: {accuracy * 100:.2f}%')
38
 
39
- # Save the model
40
- model.save('my_custom_text_classifier')
41
 
42
  # Later, load the model and make predictions
43
- loaded_model = tf.keras.models.load_model('my_custom_text_classifier')
44
 
45
  # Example prediction
46
  new_texts = ["I'm feeling great!", "This book is boring."]
 
36
  loss, accuracy = model.evaluate(X_test, y_test)
37
  print(f'Accuracy: {accuracy * 100:.2f}%')
38
 
39
+ # Save the model with the correct filepath extension
40
+ model.save('my_custom_text_classifier.h5')
41
 
42
  # Later, load the model and make predictions
43
+ loaded_model = tf.keras.models.load_model('my_custom_text_classifier.h5')
44
 
45
  # Example prediction
46
  new_texts = ["I'm feeling great!", "This book is boring."]