DHEIVER commited on
Commit
4784749
·
1 Parent(s): 088edb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -16,10 +16,8 @@ def preprocess_image(image):
16
  def predict_pneumonia(image):
17
  img_array = preprocess_image(image)
18
  prediction = model.predict(img_array)[0][0]
19
- pneumonia_percent = np.clip(prediction * 100, 0, 100)
20
- normal_percent = np.clip((1 - prediction) * 100, 0, 100)
21
- return {"Pneumonia": pneumonia_percent, "Normal": normal_percent}
22
-
23
 
24
  inputs = gr.inputs.Image(shape=(180, 180))
25
  outputs = gr.outputs.Label(num_top_classes=2)
 
16
  def predict_pneumonia(image):
17
  img_array = preprocess_image(image)
18
  prediction = model.predict(img_array)[0][0]
19
+ pneumonia_prediction = 1 if prediction >= 0.5 else 0
20
+ return {"Pneumonia": pneumonia_prediction}
 
 
21
 
22
  inputs = gr.inputs.Image(shape=(180, 180))
23
  outputs = gr.outputs.Label(num_top_classes=2)