Update app.py
Browse files
app.py
CHANGED
|
@@ -207,28 +207,24 @@ if uploaded_file is not None:
|
|
| 207 |
|
| 208 |
cavs = decompose_cavity(y_pred_th)
|
| 209 |
|
| 210 |
-
|
| 211 |
-
|
| 212 |
image_decomposed = np.zeros((128,128))
|
| 213 |
for i, cav in enumerate(cavs):
|
| 214 |
-
|
| 215 |
-
|
| 216 |
image_decomposed += (i+1) * np.where(cav > 0, 1, 0)
|
| 217 |
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
# except: image_decomposed = np.zeros((128,128))
|
| 223 |
try: _ = image_decomposed
|
| 224 |
except: image_decomposed = np.zeros((128,128))
|
| 225 |
plot_decomposed(image_decomposed)
|
| 226 |
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
# # res = f.read()
|
| 233 |
-
# st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
|
| 234 |
-
# download = st.download_button(label="Download", data=ccd, file_name='prediction.fits', mime="application/octet-stream")
|
|
|
|
| 207 |
|
| 208 |
cavs = decompose_cavity(y_pred_th)
|
| 209 |
|
| 210 |
+
ccd = CCDData(y_pred, unit="adu", wcs=wcs)
|
| 211 |
+
ccd.write(f"predictions/predicted.fits", overwrite=True)
|
| 212 |
image_decomposed = np.zeros((128,128))
|
| 213 |
for i, cav in enumerate(cavs):
|
| 214 |
+
ccd = CCDData(cav, unit="adu", wcs=wcs)
|
| 215 |
+
ccd.write(f"predictions/predicted_{i+1}.fits", overwrite=True)
|
| 216 |
image_decomposed += (i+1) * np.where(cav > 0, 1, 0)
|
| 217 |
|
| 218 |
+
shutil.make_archive("predictions.zip", 'zip', "predictions")
|
| 219 |
+
|
| 220 |
+
shutil.make_archive("predictions", 'zip', "predictions")
|
| 221 |
+
|
|
|
|
| 222 |
try: _ = image_decomposed
|
| 223 |
except: image_decomposed = np.zeros((128,128))
|
| 224 |
plot_decomposed(image_decomposed)
|
| 225 |
|
| 226 |
+
with col6:
|
| 227 |
+
with open('predictions.zip', 'rb') as f:
|
| 228 |
+
res = f.read()
|
| 229 |
+
st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
|
| 230 |
+
download = st.download_button(label="Download", data=res, file_name='prediction.fits', mime="application/octet-stream")
|
|
|
|
|
|
|
|
|