Horus7 commited on
Commit
22be932
1 Parent(s): c60bdab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
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('model_cv.h5')
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
- if prediction[0] <= 0.80:
20
- return "Pneumonia Detected!"
21
-
22
- return "Pneumonia Not Detected!"
 
 
 
 
 
 
 
 
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)