Update app.py
Browse files
app.py
CHANGED
@@ -6,8 +6,6 @@ import numpy as np
|
|
6 |
import cv2
|
7 |
import tensorflow as tf
|
8 |
|
9 |
-
# Restante do seu código ...
|
10 |
-
|
11 |
# Load the model
|
12 |
model = tf.keras.models.load_model('model.h5')
|
13 |
|
@@ -28,16 +26,6 @@ def predict_pneumonia(image):
|
|
28 |
else:
|
29 |
pneumonia_prediction = 0
|
30 |
|
31 |
-
# Return the probability of each class
|
32 |
-
class_probabilities = np.array(model.predict(img_array))
|
33 |
-
|
34 |
-
# Return the top two possible classifications
|
35 |
-
top_classes = np.argsort(class_probabilities[0])[-2:]
|
36 |
-
|
37 |
-
# Return the class names and the confidence scores for each class
|
38 |
-
class_names = ["Pneumonia", "Normal"]
|
39 |
-
confidence_scores = class_probabilities[0]
|
40 |
-
|
41 |
return pneumonia_prediction
|
42 |
|
43 |
inputs = gr.inputs.Image(shape=(180, 180))
|
@@ -56,7 +44,7 @@ gradio_interface = gr.Interface(
|
|
56 |
["person1952_bacteria_4883.jpeg"]
|
57 |
],
|
58 |
theme="default",
|
59 |
-
allow_flagging=
|
60 |
)
|
61 |
|
62 |
gradio_interface.launch()
|
|
|
6 |
import cv2
|
7 |
import tensorflow as tf
|
8 |
|
|
|
|
|
9 |
# Load the model
|
10 |
model = tf.keras.models.load_model('model.h5')
|
11 |
|
|
|
26 |
else:
|
27 |
pneumonia_prediction = 0
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
return pneumonia_prediction
|
30 |
|
31 |
inputs = gr.inputs.Image(shape=(180, 180))
|
|
|
44 |
["person1952_bacteria_4883.jpeg"]
|
45 |
],
|
46 |
theme="default",
|
47 |
+
allow_flagging=False
|
48 |
)
|
49 |
|
50 |
gradio_interface.launch()
|