Update app.py
Browse files
app.py
CHANGED
@@ -135,12 +135,12 @@ def decompose_cavity(pred, th2=0.7, amin=6):
|
|
135 |
|
136 |
return image_decomposed
|
137 |
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
|
145 |
def change_scale():
|
146 |
del st.session_state["threshold"]
|
@@ -188,10 +188,10 @@ with col:
|
|
188 |
# data = np.zeros((128,128))
|
189 |
|
190 |
if uploaded_file is not None:
|
191 |
-
|
192 |
-
with fits.open(uploaded_file) as hdul:
|
193 |
-
|
194 |
-
|
195 |
|
196 |
# Make six columns for buttons
|
197 |
_, col1, col2, col3, col4, col5, col6, _ = st.columns([bordersize,0.5,0.5,0.5,0.5,0.5,0.5,bordersize])
|
|
|
135 |
|
136 |
return image_decomposed
|
137 |
|
138 |
+
@st.cache
|
139 |
+
def load_file(fname):
|
140 |
+
with fits.open(fname) as hdul:
|
141 |
+
data = hdul[0].data
|
142 |
+
wcs = WCS(hdul[0].header)
|
143 |
+
return data, wcs
|
144 |
|
145 |
def change_scale():
|
146 |
del st.session_state["threshold"]
|
|
|
188 |
# data = np.zeros((128,128))
|
189 |
|
190 |
if uploaded_file is not None:
|
191 |
+
data, wcs = load_file(uploaded_file)
|
192 |
+
# with fits.open(uploaded_file) as hdul:
|
193 |
+
# data = hdul[0].data
|
194 |
+
# wcs = WCS(hdul[0].header)
|
195 |
|
196 |
# Make six columns for buttons
|
197 |
_, col1, col2, col3, col4, col5, col6, _ = st.columns([bordersize,0.5,0.5,0.5,0.5,0.5,0.5,bordersize])
|