Update app.py
Browse files
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:
|
| 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 |
-
|
| 267 |
-
|
| 268 |
-
plot_image(data, scale)
|
| 269 |
-
|
| 270 |
-
if detect or threshold or st.session_state.get("decompose", False):
|
| 271 |
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
y_pred_th = np.where(y_pred > threshold, y_pred, 0)
|
| 275 |
-
|
| 276 |
-
plot_prediction(y_pred_th)
|
| 277 |
|
| 278 |
-
|
| 279 |
-
|
|
|
|
|
|
|
|
|
|
| 280 |
|
| 281 |
-
|
|
|
|
| 282 |
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
|
|
|
|
|
|
|
|
| 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")
|