Spaces:
Sleeping
Sleeping
ferferefer
commited on
Commit
•
ba63bbf
1
Parent(s):
93f38e6
Update app.py
Browse files
app.py
CHANGED
@@ -35,18 +35,19 @@ if st.button('PREDICT'):
|
|
35 |
predict_modified = img_to_array(predict)
|
36 |
predict_modified = np.expand_dims(predict_modified, axis=0)
|
37 |
result = model.predict(predict_modified)
|
|
|
38 |
if result < 0.5:
|
39 |
-
probability = 1 - result[0][0]
|
40 |
-
st.write(f"Healthy with {probability}%")
|
41 |
|
42 |
else:
|
43 |
-
probability = result[0][0]
|
44 |
-
st.write(f"Glaucoma with {probability}%")
|
45 |
|
46 |
image1 = load_img(input_image)
|
47 |
image1 = img_to_array(image1)
|
48 |
image1 = np.array(image1)
|
49 |
-
image1 = image1/255
|
50 |
|
51 |
|
52 |
|
|
|
35 |
predict_modified = img_to_array(predict)
|
36 |
predict_modified = np.expand_dims(predict_modified, axis=0)
|
37 |
result = model.predict(predict_modified)
|
38 |
+
|
39 |
if result < 0.5:
|
40 |
+
probability = (1 - result[0][0]) * 100 # Convert to percentage
|
41 |
+
st.write(f"Healthy with {probability:.2f}%") # Display with 2 decimal places
|
42 |
|
43 |
else:
|
44 |
+
probability = result[0][0] * 100 # Convert to percentage
|
45 |
+
st.write(f"Glaucoma with {probability:.2f}%") # Display with 2 decimal places
|
46 |
|
47 |
image1 = load_img(input_image)
|
48 |
image1 = img_to_array(image1)
|
49 |
image1 = np.array(image1)
|
50 |
+
image1 = image1 / 255
|
51 |
|
52 |
|
53 |
|