Update app.py
Browse files
app.py
CHANGED
@@ -2,8 +2,6 @@ import gradio as gr
|
|
2 |
import numpy as np
|
3 |
import cv2
|
4 |
import tensorflow as tf
|
5 |
-
import matplotlib
|
6 |
-
matplotlib.use('Agg')
|
7 |
|
8 |
# Load the model
|
9 |
model = tf.keras.models.load_model('model.h5')
|
@@ -26,7 +24,7 @@ def predict_pneumonia(image):
|
|
26 |
pneumonia_prediction = 0
|
27 |
|
28 |
# Return the probability of each class
|
29 |
-
class_probabilities = model.predict(img_array)
|
30 |
|
31 |
# Return the top two possible classifications
|
32 |
top_classes = np.argsort(class_probabilities[0])[-2:]
|
|
|
2 |
import numpy as np
|
3 |
import cv2
|
4 |
import tensorflow as tf
|
|
|
|
|
5 |
|
6 |
# Load the model
|
7 |
model = tf.keras.models.load_model('model.h5')
|
|
|
24 |
pneumonia_prediction = 0
|
25 |
|
26 |
# Return the probability of each class
|
27 |
+
class_probabilities = np.array(model.predict(img_array))
|
28 |
|
29 |
# Return the top two possible classifications
|
30 |
top_classes = np.argsort(class_probabilities[0])[-2:]
|