Plsek commited on
Commit
3cbdddc
·
1 Parent(s): beb9ff5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -192,7 +192,7 @@ with col_1:
192
  uploaded_file = st.file_uploader("Choose a FITS file", type=['fits'], on_change=reset_threshold)
193
 
194
  with col_2:
195
- st.markdown("<br style='margin:24px 0'>", unsafe_allow_html=True)
196
  example = st.button("Example")
197
 
198
  # with col_2:
@@ -212,10 +212,11 @@ with col_2:
212
  if uploaded_file is not None:
213
  data, wcs = load_file(uploaded_file)
214
  os.system(f'mkdir -p {uploaded_file.name.strip(".fits")}')
 
215
 
216
  if example:
217
- uploaded_file.name = "NGC4649_example.fits"
218
- data, wcs = load_file("NGC4649_example.fits")
219
 
220
  if "data" not in locals():
221
  data = np.zeros((128,128))
@@ -249,7 +250,7 @@ with col5: decompose = st.button('Decompose', key="decompose")
249
  # Make two columns for plots
250
  _, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
251
 
252
- if uploaded_file is not None:
253
  # NORMALIZE IMAGE
254
  MIN = np.min(np.where(data == 0, 1, data))
255
  if MIN < 1: data = data / MIN
@@ -258,7 +259,6 @@ if uploaded_file is not None:
258
  plot_image(image, scale)
259
 
260
  if detect or threshold or st.session_state.get("decompose", False):
261
- fname = uploaded_file.name.strip(".fits")
262
 
263
  y_pred, wcs = cut_n_predict(data, wcs, scale)
264
 
 
192
  uploaded_file = st.file_uploader("Choose a FITS file", type=['fits'], on_change=reset_threshold)
193
 
194
  with col_2:
195
+ st.markdown("<br style='margin:18px 0'>", unsafe_allow_html=True)
196
  example = st.button("Example")
197
 
198
  # with col_2:
 
212
  if uploaded_file is not None:
213
  data, wcs = load_file(uploaded_file)
214
  os.system(f'mkdir -p {uploaded_file.name.strip(".fits")}')
215
+ fname = uploaded_file.name.strip(".fits")
216
 
217
  if example:
218
+ fname = "NGC4649_example"
219
+ data, wcs = load_file(f"{fname}.fits")
220
 
221
  if "data" not in locals():
222
  data = np.zeros((128,128))
 
250
  # Make two columns for plots
251
  _, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
252
 
253
+ if (uploaded_file is not None) or example:
254
  # NORMALIZE IMAGE
255
  MIN = np.min(np.where(data == 0, 1, data))
256
  if MIN < 1: data = data / MIN
 
259
  plot_image(image, scale)
260
 
261
  if detect or threshold or st.session_state.get("decompose", False):
 
262
 
263
  y_pred, wcs = cut_n_predict(data, wcs, scale)
264