Horus7 commited on
Commit
ba8079a
1 Parent(s): 2dfea56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -13
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
- 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)
 
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)