Update app.py
Browse files
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 |
|