Update app.py
Browse files
app.py
CHANGED
@@ -5,13 +5,13 @@ import cv2
|
|
5 |
import tensorflow as tf # Assuming you're using TensorFlow for loading your model
|
6 |
|
7 |
# Load your model
|
8 |
-
model = tf.keras.models.load_model("
|
9 |
|
10 |
def img_pred(upload):
|
11 |
# Convert the Gradio input image to OpenCV format
|
12 |
opencvImage = cv2.cvtColor(np.array(upload), cv2.COLOR_RGB2BGR)
|
13 |
-
img = cv2.resize(opencvImage, (
|
14 |
-
img = img.reshape(1,
|
15 |
|
16 |
# Predict using the model and get confidence
|
17 |
predictions = model.predict(img)[0] # Get probabilities for each class
|
|
|
5 |
import tensorflow as tf # Assuming you're using TensorFlow for loading your model
|
6 |
|
7 |
# Load your model
|
8 |
+
model = tf.keras.models.load_model("brain_tumor.h5")
|
9 |
|
10 |
def img_pred(upload):
|
11 |
# Convert the Gradio input image to OpenCV format
|
12 |
opencvImage = cv2.cvtColor(np.array(upload), cv2.COLOR_RGB2BGR)
|
13 |
+
img = cv2.resize(opencvImage, (128, 128))
|
14 |
+
img = img.reshape(1, 128, 128, 3)
|
15 |
|
16 |
# Predict using the model and get confidence
|
17 |
predictions = model.predict(img)[0] # Get probabilities for each class
|