Update python save_model.py
Browse files- python save_model.py +11 -0
python save_model.py
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import tensorflow as tf
|
| 2 |
+
|
| 3 |
+
# Assume you have a trained model already (replace with your own model code)
|
| 4 |
+
model = tf.keras.Sequential([
|
| 5 |
+
tf.keras.layers.Dense(128, activation='relu', input_shape=(784,)),
|
| 6 |
+
tf.keras.layers.Dense(10, activation='softmax')
|
| 7 |
+
])
|
| 8 |
+
|
| 9 |
+
# Save the model to a file
|
| 10 |
+
model.save('my_model.h5') # Save in HDF5 format
|
| 11 |
+
print("Model saved successfully!")
|