Update app.py
Browse files
app.py
CHANGED
@@ -66,38 +66,33 @@ def cut(data0, wcs0, scale=1):
|
|
66 |
|
67 |
return data, wcs
|
68 |
|
69 |
-
# Make two columns
|
70 |
-
col1, col2 = st.columns(2)
|
71 |
-
col1.subheader("Input image")
|
72 |
-
col2.subheader("CADET prediction")
|
73 |
-
|
74 |
-
with col1:
|
75 |
-
st.markdown(
|
76 |
-
"""<style>[data-baseweb="select"] {margin-top: -50px;}</style>""",
|
77 |
-
unsafe_allow_html=True
|
78 |
-
)
|
79 |
-
|
80 |
-
max_scale = int(data.shape[0] // 128)
|
81 |
-
# scale = st.slider("Scale", 1, max_scale, 1, 1)
|
82 |
-
scale = int(st.selectbox('Scale:',[i+1 for i in range(max_scale)], label_visibility="hidden"))
|
83 |
-
|
84 |
-
with col2:
|
85 |
-
button == st.button('Detect cavities', disabled=True)
|
86 |
-
|
87 |
|
88 |
# If file is uploaded, read in the data and plot it
|
89 |
if uploaded_file is not None:
|
90 |
with fits.open(uploaded_file) as hdul:
|
91 |
data = hdul[0].data
|
92 |
wcs = WCS(hdul[0].header)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
# Add a slider to change the scale
|
95 |
with col1:
|
96 |
plot_image(np.log10(data+1), scale)
|
97 |
-
|
98 |
-
button.disabled = False
|
99 |
|
100 |
-
if button:
|
101 |
data, wcs = cut(data, wcs, scale=scale)
|
102 |
|
103 |
image = np.log10(data+1)
|
|
|
66 |
|
67 |
return data, wcs
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
# If file is uploaded, read in the data and plot it
|
71 |
if uploaded_file is not None:
|
72 |
with fits.open(uploaded_file) as hdul:
|
73 |
data = hdul[0].data
|
74 |
wcs = WCS(hdul[0].header)
|
75 |
+
|
76 |
+
# Make two columns
|
77 |
+
col1, col2 = st.columns(2)
|
78 |
+
col1.subheader("Input image")
|
79 |
+
col2.subheader("CADET prediction")
|
80 |
+
|
81 |
+
with col1:
|
82 |
+
st.markdown(
|
83 |
+
"""<style>[data-baseweb="select"] {margin-top: -50px;}</style>""",
|
84 |
+
unsafe_allow_html=True
|
85 |
+
)
|
86 |
+
|
87 |
+
max_scale = int(data.shape[0] // 128)
|
88 |
+
# scale = st.slider("Scale", 1, max_scale, 1, 1)
|
89 |
+
scale = int(st.selectbox('Scale:',[i+1 for i in range(max_scale)], label_visibility="hidden"))
|
90 |
|
91 |
# Add a slider to change the scale
|
92 |
with col1:
|
93 |
plot_image(np.log10(data+1), scale)
|
|
|
|
|
94 |
|
95 |
+
if st.button('Detect cavities'):
|
96 |
data, wcs = cut(data, wcs, scale=scale)
|
97 |
|
98 |
image = np.log10(data+1)
|