Update app.py
Browse files
app.py
CHANGED
|
@@ -142,9 +142,8 @@ def decompose_cavity(pred, th2=0.7, amin=6):
|
|
| 142 |
# wcs = WCS(hdul[0].header)
|
| 143 |
# return data, wcs
|
| 144 |
|
| 145 |
-
def change_scale():
|
| 146 |
-
|
| 147 |
-
|
| 148 |
|
| 149 |
|
| 150 |
# Use wide layout and create columns
|
|
@@ -203,7 +202,7 @@ if uploaded_file is not None:
|
|
| 203 |
with col1:
|
| 204 |
st.markdown("""<style>[data-baseweb="select"] {margin-top: -46px;}</style>""", unsafe_allow_html=True)
|
| 205 |
max_scale = int(data.shape[0] // 128)
|
| 206 |
-
scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden"
|
| 207 |
scale = int(scale.split("x")[0]) // 128
|
| 208 |
|
| 209 |
# Detect button
|
|
@@ -224,13 +223,13 @@ if uploaded_file is not None:
|
|
| 224 |
image = np.log10(data+1)
|
| 225 |
plot_image(image, scale)
|
| 226 |
|
| 227 |
-
|
| 228 |
-
#
|
| 229 |
-
|
| 230 |
|
| 231 |
-
|
| 232 |
|
| 233 |
-
|
| 234 |
|
| 235 |
# if decompose or st.session_state.get("download", False):
|
| 236 |
# image_decomposed = decompose_cavity(y_pred_th)
|
|
|
|
| 142 |
# wcs = WCS(hdul[0].header)
|
| 143 |
# return data, wcs
|
| 144 |
|
| 145 |
+
# def change_scale():
|
| 146 |
+
# del st.session_state["threshold"]
|
|
|
|
| 147 |
|
| 148 |
|
| 149 |
# Use wide layout and create columns
|
|
|
|
| 202 |
with col1:
|
| 203 |
st.markdown("""<style>[data-baseweb="select"] {margin-top: -46px;}</style>""", unsafe_allow_html=True)
|
| 204 |
max_scale = int(data.shape[0] // 128)
|
| 205 |
+
scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden") #, on_change=change_scale)
|
| 206 |
scale = int(scale.split("x")[0]) // 128
|
| 207 |
|
| 208 |
# Detect button
|
|
|
|
| 223 |
image = np.log10(data+1)
|
| 224 |
plot_image(image, scale)
|
| 225 |
|
| 226 |
+
if detect or threshold:
|
| 227 |
+
# if st.session_state.get("detect", True):
|
| 228 |
+
y_pred, wcs = cut_n_predict(data, wcs, scale)
|
| 229 |
|
| 230 |
+
y_pred_th = np.where(y_pred > threshold, y_pred, 0)
|
| 231 |
|
| 232 |
+
plot_prediction(y_pred_th)
|
| 233 |
|
| 234 |
# if decompose or st.session_state.get("download", False):
|
| 235 |
# image_decomposed = decompose_cavity(y_pred_th)
|