Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,18 +8,24 @@ from keras.models import load_model
|
|
8 |
from tensorflow.keras.utils import load_img
|
9 |
|
10 |
# Charger le modèle
|
11 |
-
model = load_model('
|
12 |
|
13 |
|
14 |
|
15 |
def detect(img):
|
16 |
-
img = np.expand_dims(img, axis=0)
|
17 |
-
img = img/255
|
18 |
prediction = model.predict(img)[0]
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
|
25 |
# result = detect(img)
|
|
|
8 |
from tensorflow.keras.utils import load_img
|
9 |
|
10 |
# Charger le modèle
|
11 |
+
model = load_model('model_multi.h5')
|
12 |
|
13 |
|
14 |
|
15 |
def detect(img):
|
|
|
|
|
16 |
prediction = model.predict(img)[0]
|
17 |
+
print(prediction)
|
18 |
+
|
19 |
+
def format_decimal(value):
|
20 |
+
decimal_value = format(value, ".2f")
|
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)
|