Horus7 commited on
Commit
94fe01a
1 Parent(s): 8862ebf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -12,15 +12,20 @@ from tensorflow.keras.utils import load_img
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)
 
12
  model = load_model('model_cv.h5')
13
 
14
 
15
+ def format_decimal(value):
16
+ decimal_value = format(value, ".2f")
17
+ return decimal_value
18
+
19
  def detect(img):
20
  img = np.expand_dims(img, axis=0)
21
  img = img/255
22
  prediction = model.predict(img)[0]
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)