Plsek commited on
Commit
271da63
·
1 Parent(s): 2345ad9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -30
app.py CHANGED
@@ -195,9 +195,8 @@ with col_1:
195
  uploaded_file = st.file_uploader("Choose a FITS file", type=['fits'], on_change=reset_all)
196
 
197
  with col_2:
198
- st.markdown("<br style='margin:15px 0'>", unsafe_allow_html=True)
199
- if st.button("Example"):
200
- st.session_state['example'] = True
201
 
202
  # with col_2:
203
  # st.markdown("### Examples")
@@ -263,34 +262,33 @@ with col5: decompose = st.button('Decompose', key="decompose")
263
  # Make two columns for plots
264
  _, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
265
 
266
- if "data" in locals():
267
- # NORMALIZE IMAGE
268
- plot_image(data, scale)
269
-
270
- if detect or threshold or st.session_state.get("decompose", False):
271
 
272
- y_pred, wcs = cut_n_predict(data, wcs, scale)
273
-
274
- y_pred_th = np.where(y_pred > threshold, y_pred, 0)
275
-
276
- plot_prediction(y_pred_th)
277
 
278
- if decompose or st.session_state.get("download", False):
279
- image_decomposed = decompose_cavity(y_pred_th, fname)
 
 
 
280
 
281
- plot_decomposed(image_decomposed)
 
282
 
283
- with col6:
284
- st.markdown("<br style='margin:4px 0'>", unsafe_allow_html=True)
285
- # st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
286
-
287
- # if st.session_state.get("download", False):
288
-
289
- shutil.make_archive(fname, 'zip', fname)
290
- with open(f"{fname}.zip", 'rb') as f:
291
- res = f.read()
292
-
293
- download = st.download_button(label="Download", data=res, key="download",
294
- file_name=f'{fname}_{int(scale*128)}.zip',
295
- # disabled=st.session_state.get("disabled", True),
296
- mime="application/octet-stream")
 
 
 
195
  uploaded_file = st.file_uploader("Choose a FITS file", type=['fits'], on_change=reset_all)
196
 
197
  with col_2:
198
+ st.markdown("<br style='margin:14px 0'>", unsafe_allow_html=True)
199
+ if st.button("Example"): st.session_state['example'] = True
 
200
 
201
  # with col_2:
202
  # st.markdown("### Examples")
 
262
  # Make two columns for plots
263
  _, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
264
 
265
+ # NORMALIZE IMAGE
266
+ plot_image(data, scale)
 
 
 
267
 
268
+ if detect or threshold or st.session_state.get("decompose", False):
 
 
 
 
269
 
270
+ y_pred, wcs = cut_n_predict(data, wcs, scale)
271
+
272
+ y_pred_th = np.where(y_pred > threshold, y_pred, 0)
273
+
274
+ plot_prediction(y_pred_th)
275
 
276
+ if decompose or st.session_state.get("download", False):
277
+ image_decomposed = decompose_cavity(y_pred_th, fname)
278
 
279
+ plot_decomposed(image_decomposed)
280
+
281
+ with col6:
282
+ st.markdown("<br style='margin:4px 0'>", unsafe_allow_html=True)
283
+ # st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
284
+
285
+ # if st.session_state.get("download", False):
286
+
287
+ shutil.make_archive(fname, 'zip', fname)
288
+ with open(f"{fname}.zip", 'rb') as f:
289
+ res = f.read()
290
+
291
+ download = st.download_button(label="Download", data=res, key="download",
292
+ file_name=f'{fname}_{int(scale*128)}.zip',
293
+ # disabled=st.session_state.get("disabled", True),
294
+ mime="application/octet-stream")