Update README.md
Browse files
README.md
CHANGED
|
@@ -46,20 +46,20 @@ Users should test the model on other datasets to ensure generalizability and acc
|
|
| 46 |
|
| 47 |
**Here is a sample code snippet to use the model:**
|
| 48 |
|
| 49 |
-
|
| 50 |
* from tensorflow.keras.utils import load_img, img_to_array
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
* Load and preprocess an image:
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
* Predict with the model:
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
## Training Details
|
| 65 |
|
|
|
|
| 46 |
|
| 47 |
**Here is a sample code snippet to use the model:**
|
| 48 |
|
| 49 |
+
* import tensorflow as tf
|
| 50 |
* from tensorflow.keras.utils import load_img, img_to_array
|
| 51 |
+
* import numpy as np
|
| 52 |
+
|
| 53 |
+
* Load and preprocess an image:
|
| 54 |
+
* img_path = 'path_to_image.jpg'
|
| 55 |
+
* img = load_img(img_path, target_size=(224, 224))
|
| 56 |
+
* img_array = img_to_array(img) / 255.0
|
| 57 |
+
* img_array = np.expand_dims(img_array, axis=0)
|
| 58 |
+
|
| 59 |
+
* Predict with the model:
|
| 60 |
+
* prediction = model.predict(img_array)
|
| 61 |
+
* predicted_class = prediction.argmax()
|
| 62 |
+
* print(f"Predicted class: {predicted_class}")
|
| 63 |
|
| 64 |
## Training Details
|
| 65 |
|