Plsek commited on
Commit
17b9e5d
·
1 Parent(s): 6b286d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -130,7 +130,7 @@ def decompose_cavity(pred, th2=0.7, amin=10):
130
  ccd.write(f"predictions/predicted_{i+1}.fits", overwrite=True)
131
  image_decomposed += (i+1) * np.where(cav > 0, 1, 0)
132
 
133
- shutil.make_archive("predictions", 'zip', "predictions")
134
 
135
  return image_decomposed
136
 
@@ -166,13 +166,14 @@ if uploaded_file is not None:
166
  col6.subheader("")
167
 
168
  with col1:
169
- st.markdown("""<style>[data-baseweb="select"] {margin-top: -26px;}</style>""", unsafe_allow_html=True)
 
170
  max_scale = int(data.shape[0] // 128)
171
  scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden")
172
  scale = int(scale.split("x")[0]) // 128
173
 
174
  # Detect button
175
- with col3: detect = st.button('Detect')
176
 
177
  # Threshold slider
178
  with col4:
@@ -184,16 +185,17 @@ if uploaded_file is not None:
184
  with col5: decompose = st.button('Decompose', key="decompose")
185
 
186
  with col6:
187
- st.markdown("")
188
- st.markdown("")
189
  # st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
190
  fname = uploaded_file.name.strip(".fits")
191
- shutil.make_archive("predictions", 'zip', "predictions")
192
- with open('predictions.zip', 'rb') as f:
193
- res = f.read()
194
 
195
  if st.session_state.get("decompose", False):
196
  st.session_state.disabled = False
 
 
 
 
 
197
  download = st.download_button(label="Download", data=res,
198
  file_name=f'{fname}_{int(scale*128)}.zip',
199
  disabled=st.session_state.get("disabled", True),
 
130
  ccd.write(f"predictions/predicted_{i+1}.fits", overwrite=True)
131
  image_decomposed += (i+1) * np.where(cav > 0, 1, 0)
132
 
133
+ # shutil.make_archive("predictions", 'zip', "predictions")
134
 
135
  return image_decomposed
136
 
 
166
  col6.subheader("")
167
 
168
  with col1:
169
+ # st.markdown("""<style>[data-baseweb="select"] {margin-top: -26px;}</style>""", unsafe_allow_html=True)
170
+ st.markdown("<style>{margin-top: -26px;}</style>") #, unsafe_allow_html=True)
171
  max_scale = int(data.shape[0] // 128)
172
  scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden")
173
  scale = int(scale.split("x")[0]) // 128
174
 
175
  # Detect button
176
+ with col3: detect = st.button('Detect', key="detect")
177
 
178
  # Threshold slider
179
  with col4:
 
185
  with col5: decompose = st.button('Decompose', key="decompose")
186
 
187
  with col6:
188
+ st.markdown("<br><br>")
 
189
  # st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
190
  fname = uploaded_file.name.strip(".fits")
 
 
 
191
 
192
  if st.session_state.get("decompose", False):
193
  st.session_state.disabled = False
194
+
195
+ shutil.make_archive("predictions", 'zip', "predictions")
196
+ with open('predictions.zip', 'rb') as f:
197
+ res = f.read()
198
+
199
  download = st.download_button(label="Download", data=res,
200
  file_name=f'{fname}_{int(scale*128)}.zip',
201
  disabled=st.session_state.get("disabled", True),