Spaces:
Sleeping
Sleeping
Update tr.py
Browse files
tr.py
CHANGED
|
@@ -42,12 +42,12 @@ loss, accuracy = model.evaluate(X_test, y_test)
|
|
| 42 |
print(f'Accuracy: {accuracy * 100:.2f}%')
|
| 43 |
|
| 44 |
# Save the model with the correct filepath extension
|
| 45 |
-
|
| 46 |
-
tf.saved_model.save(model, "my_custom_text_classifier")
|
| 47 |
|
| 48 |
# Later, load the model and make predictions
|
| 49 |
-
|
| 50 |
-
loaded_model =tf.keras.layers.TFSMLayer("my_custom_text_classifier", call_endpoint="serving_default")
|
| 51 |
|
| 52 |
|
| 53 |
# Example prediction
|
|
|
|
| 42 |
print(f'Accuracy: {accuracy * 100:.2f}%')
|
| 43 |
|
| 44 |
# Save the model with the correct filepath extension
|
| 45 |
+
model.save('my_custom_text_classifier.keras')
|
| 46 |
+
# tf.saved_model.save(model, "my_custom_text_classifier")
|
| 47 |
|
| 48 |
# Later, load the model and make predictions
|
| 49 |
+
loaded_model = tf.keras.models.load_model('my_custom_text_classifier.keras')
|
| 50 |
+
# loaded_model =tf.keras.layers.TFSMLayer("my_custom_text_classifier", call_endpoint="serving_default")
|
| 51 |
|
| 52 |
|
| 53 |
# Example prediction
|