Spaces:
Build error
Build error
Alok Bhattarai
commited on
Commit
·
50b0082
1
Parent(s):
08bd9f6
bug fix
Browse files
app.py
CHANGED
|
@@ -39,13 +39,14 @@ st.markdown("[Dataset Source](https://www.kaggle.com/datasets/tourist55/alzheime
|
|
| 39 |
model = tf.keras.models.load_model('./model/model_1.h5')
|
| 40 |
model.load_weights('./model/best_model_custom_1.h5')
|
| 41 |
|
| 42 |
-
uploaded_file = st.file_uploader("Upload a brain MRI image here", type=["jpg", "png", "jpeg"]
|
| 43 |
-
predict_button = st.button("ㅤㅤPredictㅤㅤ")
|
| 44 |
|
| 45 |
if uploaded_file is not None:
|
| 46 |
file_bytes = BytesIO(uploaded_file.read())
|
| 47 |
st.image(file_bytes,use_column_width=True,clamp = True)
|
| 48 |
|
|
|
|
|
|
|
| 49 |
img = cv2.imdecode(np.frombuffer(file_bytes.read(), np.uint8), 0)
|
| 50 |
#img=np.array(file_bytes)
|
| 51 |
|
|
@@ -61,19 +62,19 @@ if uploaded_file is not None:
|
|
| 61 |
predict_val = np.argmax(pred, axis=1)
|
| 62 |
|
| 63 |
if predict_val == 0:
|
| 64 |
-
probability = pred[predict_val]
|
| 65 |
st.write(f"Mildly Demented with prediction probability of {probability}")
|
| 66 |
|
| 67 |
elif predict_val == 1:
|
| 68 |
-
probability = pred[predict_val]
|
| 69 |
st.write(f"Moderately Demented with prediction probability of {probability}")
|
| 70 |
|
| 71 |
elif predict_val == 2:
|
| 72 |
-
probability = pred[predict_val]
|
| 73 |
st.write(f"Not Demented with prediction probability of {probability}")
|
| 74 |
|
| 75 |
elif predict_val == 3:
|
| 76 |
-
probability = pred[predict_val]
|
| 77 |
st.write(f"Very Mildly Demented with prediction probability of {probability}")
|
| 78 |
|
| 79 |
else:
|
|
|
|
| 39 |
model = tf.keras.models.load_model('./model/model_1.h5')
|
| 40 |
model.load_weights('./model/best_model_custom_1.h5')
|
| 41 |
|
| 42 |
+
uploaded_file = st.file_uploader("Upload a brain MRI image here", type=["jpg", "png", "jpeg"])
|
|
|
|
| 43 |
|
| 44 |
if uploaded_file is not None:
|
| 45 |
file_bytes = BytesIO(uploaded_file.read())
|
| 46 |
st.image(file_bytes,use_column_width=True,clamp = True)
|
| 47 |
|
| 48 |
+
predict_button = st.button("ㅤㅤPredictㅤㅤ")
|
| 49 |
+
if predict_button:
|
| 50 |
img = cv2.imdecode(np.frombuffer(file_bytes.read(), np.uint8), 0)
|
| 51 |
#img=np.array(file_bytes)
|
| 52 |
|
|
|
|
| 62 |
predict_val = np.argmax(pred, axis=1)
|
| 63 |
|
| 64 |
if predict_val == 0:
|
| 65 |
+
probability = pred[0][predict_val]
|
| 66 |
st.write(f"Mildly Demented with prediction probability of {probability}")
|
| 67 |
|
| 68 |
elif predict_val == 1:
|
| 69 |
+
probability = pred[0][predict_val]
|
| 70 |
st.write(f"Moderately Demented with prediction probability of {probability}")
|
| 71 |
|
| 72 |
elif predict_val == 2:
|
| 73 |
+
probability = pred[0][predict_val]
|
| 74 |
st.write(f"Not Demented with prediction probability of {probability}")
|
| 75 |
|
| 76 |
elif predict_val == 3:
|
| 77 |
+
probability = pred[0][predict_val]
|
| 78 |
st.write(f"Very Mildly Demented with prediction probability of {probability}")
|
| 79 |
|
| 80 |
else:
|