Plsek commited on
Commit
8ede926
·
1 Parent(s): 1775b37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -17
app.py CHANGED
@@ -207,28 +207,24 @@ if uploaded_file is not None:
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
- # np.save("decomposed.npy", image_decomposed)
220
-
221
- # try: image_decomposed = np.load("decomposed.npy")
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
- # shutil.make_archive("predictions", 'zip', "predictions")
228
-
229
- # with col6:
230
- # ccd = CCDData(y_pred, unit="adu", wcs=wcs)
231
- # # with open('predictions.zip', 'rb') as f:
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")