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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -16,10 +16,11 @@ 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 = prediction * 100
20
- normal_percent = (1 - prediction) * 100
21
  return {"Pneumonia": pneumonia_percent, "Normal": normal_percent}
22
 
 
23
  inputs = gr.inputs.Image(shape=(180, 180))
24
  outputs = gr.outputs.Label(num_top_classes=2)
25
 
 
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)
26