Update app.py
Browse files
app.py
CHANGED
@@ -26,8 +26,6 @@ uploaded_file = st.file_uploader("Choose a FITS file", type=['fits'])
|
|
26 |
|
27 |
# Make two columns
|
28 |
col1, col2 = st.columns(2)
|
29 |
-
col1.subheader("Input image")
|
30 |
-
col2.subheader("CADET prediction")
|
31 |
|
32 |
# Define function to plot the uploaded image
|
33 |
def plot_image(image_array, scale):
|
@@ -74,6 +72,9 @@ def cut(data0, wcs0, scale=1):
|
|
74 |
|
75 |
# If file is uploaded, read in the data and plot it
|
76 |
if uploaded_file is not None:
|
|
|
|
|
|
|
77 |
with fits.open(uploaded_file) as hdul:
|
78 |
data = hdul[0].data
|
79 |
wcs = WCS(hdul[0].header)
|
@@ -82,12 +83,14 @@ if uploaded_file is not None:
|
|
82 |
# Add a slider to change the scale
|
83 |
with col1:
|
84 |
max_scale = int(data.shape[0] // 128)
|
85 |
-
scale = st.slider("Scale", 1, max_scale, 1, 1)
|
|
|
|
|
86 |
|
87 |
plot_image(image, scale)
|
88 |
|
89 |
with col2:
|
90 |
-
st.button('Detect cavities')
|
91 |
data, wcs = cut(data, wcs, scale=scale)
|
92 |
|
93 |
y_pred = 0
|
|
|
26 |
|
27 |
# Make two columns
|
28 |
col1, col2 = st.columns(2)
|
|
|
|
|
29 |
|
30 |
# Define function to plot the uploaded image
|
31 |
def plot_image(image_array, scale):
|
|
|
72 |
|
73 |
# If file is uploaded, read in the data and plot it
|
74 |
if uploaded_file is not None:
|
75 |
+
col1.subheader("Input image")
|
76 |
+
col2.subheader("CADET prediction")
|
77 |
+
|
78 |
with fits.open(uploaded_file) as hdul:
|
79 |
data = hdul[0].data
|
80 |
wcs = WCS(hdul[0].header)
|
|
|
83 |
# Add a slider to change the scale
|
84 |
with col1:
|
85 |
max_scale = int(data.shape[0] // 128)
|
86 |
+
# scale = st.slider("Scale", 1, max_scale, 1, 1)
|
87 |
+
|
88 |
+
scale = st.selectbox('Scale:',[i for i in range(max_scale)])
|
89 |
|
90 |
plot_image(image, scale)
|
91 |
|
92 |
with col2:
|
93 |
+
st.button('Detect cavities')
|
94 |
data, wcs = cut(data, wcs, scale=scale)
|
95 |
|
96 |
y_pred = 0
|