Thomas Lucchetta
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,6 +37,9 @@ load_img = LoadImage(image_only=True)
|
|
| 37 |
#SET CLASSES
|
| 38 |
class_names = CLASSES
|
| 39 |
|
|
|
|
|
|
|
|
|
|
| 40 |
#SET STREAMLIT SESSION STATES
|
| 41 |
if 'clicked_pp' not in st.session_state:
|
| 42 |
st.session_state.clicked_pp = False
|
|
@@ -86,8 +89,8 @@ with st.container():
|
|
| 86 |
x_value_pred = st.sidebar.slider('Move the slider to adjust the sagittal cut ', bounds_pred[0][0], bounds_pred[0][1], mean([bounds_pred[0][0], bounds_pred[0][1]]))
|
| 87 |
z_value_pred = st.sidebar.slider('Move the slider to adjust the axial cut ', bounds_pred[2][0], bounds_pred[2][1], mean([bounds_pred[2][0], bounds_pred[2][1]]))
|
| 88 |
|
| 89 |
-
|
| 90 |
-
st.pyplot(
|
| 91 |
|
| 92 |
else:
|
| 93 |
with st.container():
|
|
@@ -138,8 +141,8 @@ with st.container():
|
|
| 138 |
with pred_col:
|
| 139 |
st.write(f"### Probability: :{color_prob}[{predicted_probability:.2f}%]")
|
| 140 |
|
| 141 |
-
|
| 142 |
-
st.pyplot(
|
| 143 |
|
| 144 |
else:
|
| 145 |
raw_image = nib.load(hf_hub_download(repo_id= "rootstrap-org/Alzheimer-Classifier-Demo", repo_type="dataset", subfolder="raw", filename = img_path + ".nii"))
|
|
@@ -151,5 +154,5 @@ with st.container():
|
|
| 151 |
x_value_raw = st.sidebar.slider('Move the slider to adjust the sagittal cut', bounds_raw[0][0], bounds_raw[0][1], mean([bounds_raw[0][0], bounds_raw[0][1]]))
|
| 152 |
z_value_raw = st.sidebar.slider('Move the slider to adjust the axial cut', bounds_raw[2][0], bounds_raw[2][1], mean([bounds_raw[2][0], bounds_raw[2][1]]))
|
| 153 |
|
| 154 |
-
|
| 155 |
-
st.pyplot(
|
|
|
|
| 37 |
#SET CLASSES
|
| 38 |
class_names = CLASSES
|
| 39 |
|
| 40 |
+
#SILENCE STREAMIT WARNING
|
| 41 |
+
st.set_option('deprecation.showPyplotGlobalUse', False)
|
| 42 |
+
|
| 43 |
#SET STREAMLIT SESSION STATES
|
| 44 |
if 'clicked_pp' not in st.session_state:
|
| 45 |
st.session_state.clicked_pp = False
|
|
|
|
| 89 |
x_value_pred = st.sidebar.slider('Move the slider to adjust the sagittal cut ', bounds_pred[0][0], bounds_pred[0][1], mean([bounds_pred[0][0], bounds_pred[0][1]]))
|
| 90 |
z_value_pred = st.sidebar.slider('Move the slider to adjust the axial cut ', bounds_pred[2][0], bounds_pred[2][1], mean([bounds_pred[2][0], bounds_pred[2][1]]))
|
| 91 |
|
| 92 |
+
plotting.plot_img(pred_image, cmap="grey", cut_coords=(x_value_pred,y_value_pred,z_value_pred), black_bg=True)
|
| 93 |
+
st.pyplot()
|
| 94 |
|
| 95 |
else:
|
| 96 |
with st.container():
|
|
|
|
| 141 |
with pred_col:
|
| 142 |
st.write(f"### Probability: :{color_prob}[{predicted_probability:.2f}%]")
|
| 143 |
|
| 144 |
+
plotting.plot_img(pred_image, cmap="grey", cut_coords=(x_value_pred,y_value_pred,z_value_pred), black_bg=True)
|
| 145 |
+
st.pyplot()
|
| 146 |
|
| 147 |
else:
|
| 148 |
raw_image = nib.load(hf_hub_download(repo_id= "rootstrap-org/Alzheimer-Classifier-Demo", repo_type="dataset", subfolder="raw", filename = img_path + ".nii"))
|
|
|
|
| 154 |
x_value_raw = st.sidebar.slider('Move the slider to adjust the sagittal cut', bounds_raw[0][0], bounds_raw[0][1], mean([bounds_raw[0][0], bounds_raw[0][1]]))
|
| 155 |
z_value_raw = st.sidebar.slider('Move the slider to adjust the axial cut', bounds_raw[2][0], bounds_raw[2][1], mean([bounds_raw[2][0], bounds_raw[2][1]]))
|
| 156 |
|
| 157 |
+
plotting.plot_img(raw_image, cmap = "grey", cut_coords=(x_value_raw,y_value_raw,z_value_raw), black_bg=True)
|
| 158 |
+
st.pyplot()
|