Plsek commited on
Commit
bb17b88
·
1 Parent(s): 3974601

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -117,8 +117,8 @@ if uploaded_file is not None:
117
  st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
118
  max_scale = int(data.shape[0] // 128)
119
  # scale = int(st.selectbox('Scale:',[i+1 for i in range(max_scale)], label_visibility="hidden"))
120
- scale = int(st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden"))
121
- scale = scale.split("x")[0] // 128
122
 
123
  with col2:
124
  detect = st.button('Detect cavities')
@@ -126,30 +126,30 @@ if uploaded_file is not None:
126
  with col3:
127
  decompose = st.button('Docompose cavities')
128
 
129
- # # Make two columns for plots
130
- # colA, colB = st.columns(2)
131
 
132
- # image = np.log10(data+1)
133
- # plot_image(image, scale)
134
 
135
- # if detect:
136
- # data, wcs = cut(data, wcs, scale=scale)
137
- # image = np.log10(data+1)
138
 
139
- # y_pred = 0
140
- # for j in [0,1,2,3]:
141
- # rotated = np.rot90(image, j)
142
- # pred = model.predict(rotated.reshape(1, 128, 128, 1)).reshape(128 ,128)
143
- # pred = np.rot90(pred, -j)
144
- # y_pred += pred / 4
145
-
146
- # # Thresholding
147
- # y_pred = np.where(y_pred > 0.4, y_pred, 0)
148
-
149
- # # if decompose:
150
- # # cavs = decompose_cavity(y_pred, )
151
 
152
- # plot_prediction(y_pred, decompose)
153
 
154
  # ccd = CCDData(y_pred, unit="adu", wcs=wcs)
155
  # ccd.write("predicted.fits", overwrite=True)
 
117
  st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
118
  max_scale = int(data.shape[0] // 128)
119
  # scale = int(st.selectbox('Scale:',[i+1 for i in range(max_scale)], label_visibility="hidden"))
120
+ scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden")
121
+ scale = int(scale.split("x")[0]) // 128
122
 
123
  with col2:
124
  detect = st.button('Detect cavities')
 
126
  with col3:
127
  decompose = st.button('Docompose cavities')
128
 
129
+ # Make two columns for plots
130
+ _, colA, colB, colC, _ = st.columns([1,1,1,1,1])
131
 
132
+ image = np.log10(data+1)
133
+ plot_image(image, scale)
134
 
135
+ if detect:
136
+ data, wcs = cut(data, wcs, scale=scale)
137
+ image = np.log10(data+1)
138
 
139
+ y_pred = 0
140
+ for j in [0,1,2,3]:
141
+ rotated = np.rot90(image, j)
142
+ pred = model.predict(rotated.reshape(1, 128, 128, 1)).reshape(128 ,128)
143
+ pred = np.rot90(pred, -j)
144
+ y_pred += pred / 4
145
+
146
+ # Thresholding
147
+ y_pred = np.where(y_pred > 0.4, y_pred, 0)
148
+
149
+ # if decompose:
150
+ # cavs = decompose_cavity(y_pred, )
151
 
152
+ plot_prediction(y_pred, decompose)
153
 
154
  # ccd = CCDData(y_pred, unit="adu", wcs=wcs)
155
  # ccd.write("predicted.fits", overwrite=True)