Update app.py
Browse files
app.py
CHANGED
@@ -22,24 +22,9 @@ def predict_pneumonia(image):
|
|
22 |
threshold = 0.5
|
23 |
|
24 |
if prediction >= threshold:
|
25 |
-
|
26 |
-
class_name = "Pneumonia"
|
27 |
-
pneumonia_probability = prediction
|
28 |
-
normal_probability = 1 - prediction
|
29 |
else:
|
30 |
-
|
31 |
-
class_name = "Normal"
|
32 |
-
pneumonia_probability = 1 - prediction
|
33 |
-
normal_probability = prediction
|
34 |
-
|
35 |
-
return {
|
36 |
-
"Pneumonia Prediction": pneumonia_prediction,
|
37 |
-
"Class Name": class_name,
|
38 |
-
"Pneumonia Probability": pneumonia_probability,
|
39 |
-
"Normal Probability": normal_probability
|
40 |
-
}
|
41 |
-
|
42 |
-
|
43 |
|
44 |
inputs = gr.inputs.Image(shape=(180, 180))
|
45 |
outputs = gr.outputs.Label(num_top_classes=2)
|
|
|
22 |
threshold = 0.5
|
23 |
|
24 |
if prediction >= threshold:
|
25 |
+
return "Pneumonia"
|
|
|
|
|
|
|
26 |
else:
|
27 |
+
return "Normal"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
inputs = gr.inputs.Image(shape=(180, 180))
|
30 |
outputs = gr.outputs.Label(num_top_classes=2)
|