Update app.py
Browse files
app.py
CHANGED
@@ -166,8 +166,8 @@ if uploaded_file is not None:
|
|
166 |
col6.subheader("")
|
167 |
|
168 |
with col1:
|
169 |
-
|
170 |
-
st.markdown("<style>{margin-top: -26px;}</style>"
|
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
|
@@ -183,23 +183,6 @@ if uploaded_file is not None:
|
|
183 |
|
184 |
# Decompose button
|
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),
|
202 |
-
mime="application/octet-stream")
|
203 |
|
204 |
# Make two columns for plots
|
205 |
_, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
|
@@ -214,8 +197,23 @@ if uploaded_file is not None:
|
|
214 |
|
215 |
plot_prediction(y_pred_th)
|
216 |
|
217 |
-
|
218 |
-
if decompose or download:
|
219 |
image_decomposed = decompose_cavity(y_pred_th)
|
220 |
|
221 |
-
plot_decomposed(image_decomposed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
183 |
|
184 |
# Decompose button
|
185 |
with col5: decompose = st.button('Decompose', key="decompose")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
# Make two columns for plots
|
188 |
_, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
|
|
|
197 |
|
198 |
plot_prediction(y_pred_th)
|
199 |
|
200 |
+
if decompose or st.session_state.get("download", False):
|
|
|
201 |
image_decomposed = decompose_cavity(y_pred_th)
|
202 |
|
203 |
+
plot_decomposed(image_decomposed)
|
204 |
+
|
205 |
+
with col6:
|
206 |
+
st.markdown("<br><br>", unsafe_allow_html=True)
|
207 |
+
# st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
|
208 |
+
fname = uploaded_file.name.strip(".fits")
|
209 |
+
|
210 |
+
# if st.session_state.get("download", False):
|
211 |
+
|
212 |
+
shutil.make_archive("predictions", 'zip', "predictions")
|
213 |
+
with open('predictions.zip', 'rb') as f:
|
214 |
+
res = f.read()
|
215 |
+
|
216 |
+
download = st.download_button(label="Download", data=res, key="download",
|
217 |
+
file_name=f'{fname}_{int(scale*128)}.zip',
|
218 |
+
# disabled=st.session_state.get("disabled", True),
|
219 |
+
mime="application/octet-stream")
|