Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,24 +8,19 @@ from keras.models import load_model
|
|
8 |
from tensorflow.keras.utils import load_img
|
9 |
|
10 |
# Charger le modèle
|
11 |
-
|
|
|
12 |
|
13 |
|
14 |
|
15 |
def detect(img):
|
|
|
|
|
16 |
prediction = model.predict(img)[0]
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
return decimal_value
|
22 |
-
|
23 |
-
if format_decimal(prediction[0]) >= "0.5":
|
24 |
-
return "Bactérie détectée"
|
25 |
-
if format_decimal(prediction[1]) >= "0.5":
|
26 |
-
return "Poumon sain"
|
27 |
-
if format_decimal(prediction[2]) >= "0.5":
|
28 |
-
return "Virus détecté"
|
29 |
|
30 |
|
31 |
# result = detect(img)
|
|
|
8 |
from tensorflow.keras.utils import load_img
|
9 |
|
10 |
# Charger le modèle
|
11 |
+
|
12 |
+
model = load_model('model_cv.h5')
|
13 |
|
14 |
|
15 |
|
16 |
def detect(img):
|
17 |
+
img = np.expand_dims(img, axis=0)
|
18 |
+
img = img/255
|
19 |
prediction = model.predict(img)[0]
|
20 |
+
if prediction[0] <= 0.80:
|
21 |
+
return "Pneumonia Detected!"
|
22 |
+
|
23 |
+
return "Pneumonia Not Detected!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
|
26 |
# result = detect(img)
|