tlucch commited on
Commit
8623c4c
·
1 Parent(s): 80ce317
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -65,7 +65,7 @@ with st.sidebar:
65
  st.title("Alzheimer Classifier Demo")
66
  img_path = st.selectbox(
67
  "Select Image",
68
- class_names,
69
  on_change= click_false,
70
  )
71
  col1, col2 = st.columns((1,1))
@@ -80,7 +80,7 @@ with st.container():
80
  if st.session_state.clicked_pp:
81
  if st.session_state.clicked_pred == False:
82
  with st.container():
83
- pred_image = nib.load(hf_hub_download(repo_type="dataset", subfolder="preprocessed", filename = img_path + ".nii.gz"))
84
 
85
  bounds_pred = plotting.find_cuts._get_auto_mask_bounds(pred_image)
86
 
@@ -94,7 +94,7 @@ with st.container():
94
 
95
  else:
96
  with st.container():
97
- pred_image = nib.load(hf_hub_download(repo_type="dataset", subfolder="preprocessed", filename = img_path + ".nii.gz"))
98
 
99
  bounds_pred = plotting.find_cuts._get_auto_mask_bounds(pred_image)
100
 
@@ -103,7 +103,7 @@ with st.container():
103
  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]]))
104
  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]]))
105
 
106
- img_array = load_img(hf_hub_download(repo_type="dataset", subfolder="preprocessed", filename = img_path + ".nii.gz"))
107
  new_data = transforms(img_array)
108
  new_data_tensor = torch.from_numpy(np.array([new_data]))
109
 
@@ -145,7 +145,7 @@ with st.container():
145
  st.pyplot()
146
 
147
  else:
148
- raw_image = nib.load(hf_hub_download(repo_type="dataset", subfolder="raw", filename = img_path + ".nii"))
149
 
150
  bounds_raw = plotting.find_cuts._get_auto_mask_bounds(raw_image)
151
 
 
65
  st.title("Alzheimer Classifier Demo")
66
  img_path = st.selectbox(
67
  "Select Image",
68
+ tuple(class_names),
69
  on_change= click_false,
70
  )
71
  col1, col2 = st.columns((1,1))
 
80
  if st.session_state.clicked_pp:
81
  if st.session_state.clicked_pred == False:
82
  with st.container():
83
+ pred_image = nib.load(hf_hub_download(repo_id= "rootstrap/Alzheimer-Classifier-Demo", repo_type="dataset", subfolder="preprocessed", filename = img_path + ".nii.gz"))
84
 
85
  bounds_pred = plotting.find_cuts._get_auto_mask_bounds(pred_image)
86
 
 
94
 
95
  else:
96
  with st.container():
97
+ pred_image = nib.load(hf_hub_download(repo_id= "rootstrap/Alzheimer-Classifier-Demo", repo_type="dataset", subfolder="preprocessed", filename = img_path + ".nii.gz"))
98
 
99
  bounds_pred = plotting.find_cuts._get_auto_mask_bounds(pred_image)
100
 
 
103
  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]]))
104
  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]]))
105
 
106
+ img_array = load_img(hf_hub_download(repo_id= "rootstrap/Alzheimer-Classifier-Demo", repo_type="dataset", subfolder="preprocessed", filename = img_path + ".nii.gz"))
107
  new_data = transforms(img_array)
108
  new_data_tensor = torch.from_numpy(np.array([new_data]))
109
 
 
145
  st.pyplot()
146
 
147
  else:
148
+ raw_image = nib.load(hf_hub_download(repo_id= "rootstrap/Alzheimer-Classifier-Demo", repo_type="dataset", subfolder="raw", filename = img_path + ".nii"))
149
 
150
  bounds_raw = plotting.find_cuts._get_auto_mask_bounds(raw_image)
151