Plsek commited on
Commit
58a68f2
·
1 Parent(s): 8ed0f4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -33,7 +33,7 @@ with col:
33
  st.markdown("Input images should be centered at the centre of the galaxy and point sources should be filled with surrounding background ([dmfilth](https://cxc.cfa.harvard.edu/ciao/ahelp/dmfilth.html)).")
34
 
35
  # Create file uploader widget
36
- uploaded_file = st.file_uploader("Choose a FITS file", type=['fits'])
37
 
38
  # Define function to plot the uploaded image
39
  def plot_image(image, scale):
@@ -113,24 +113,28 @@ if uploaded_file is not None:
113
  _, col1, col2, col3, col4, col5, col6, _ = st.columns([bordersize,0.5,0.5,0.5,0.5,0.5,0.5,bordersize])
114
  col1.subheader("Input image")
115
  col3.subheader("Prediction")
 
116
 
117
- with col1:
118
- st.markdown("""<style>[data-baseweb="select"] {margin-top: -56px;}</style>""", unsafe_allow_html=True)
119
  max_scale = int(data.shape[0] // 128)
120
  # scale = int(st.selectbox('Scale:',[i+1 for i in range(max_scale)], label_visibility="hidden"))
121
  scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden")
122
  scale = int(scale.split("x")[0]) // 128
123
 
124
- with col3:
125
- st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
126
- detect = st.button('Detect cavities')
127
 
128
- with col5:
129
- decompose = st.button('Docompose cavities')
130
 
131
  # Make two columns for plots
132
  _, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
133
 
 
 
 
134
  image = np.log10(data+1)
135
  plot_image(image, scale)
136
 
@@ -145,9 +149,6 @@ if uploaded_file is not None:
145
  pred = np.rot90(pred, -j)
146
  y_pred += pred / 4
147
 
148
- with colB:
149
- threshold = st.slider("", 0.0, 1.0, 0.4, 0.05, label_visibility="hidden")
150
-
151
  # Thresholding
152
  y_pred = np.where(y_pred > threshold, y_pred, 0)
153
 
 
33
  st.markdown("Input images should be centered at the centre of the galaxy and point sources should be filled with surrounding background ([dmfilth](https://cxc.cfa.harvard.edu/ciao/ahelp/dmfilth.html)).")
34
 
35
  # Create file uploader widget
36
+ # uploaded_file = st.file_uploader("Choose a FITS file", type=['fits'])
37
 
38
  # Define function to plot the uploaded image
39
  def plot_image(image, scale):
 
113
  _, col1, col2, col3, col4, col5, col6, _ = st.columns([bordersize,0.5,0.5,0.5,0.5,0.5,0.5,bordersize])
114
  col1.subheader("Input image")
115
  col3.subheader("Prediction")
116
+ col5.subheader("Decomposed")
117
 
118
+ with col2:
119
+ # st.markdown("""<style>[data-baseweb="select"] {margin-top: -56px;}</style>""", unsafe_allow_html=True)
120
  max_scale = int(data.shape[0] // 128)
121
  # scale = int(st.selectbox('Scale:',[i+1 for i in range(max_scale)], label_visibility="hidden"))
122
  scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden")
123
  scale = int(scale.split("x")[0]) // 128
124
 
125
+ with col4:
126
+ # st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
127
+ detect = st.button('Detect')
128
 
129
+ with col6:
130
+ decompose = st.button('Docompose')
131
 
132
  # Make two columns for plots
133
  _, colA, colB, colC, _ = st.columns([bordersize,1,1,1,bordersize])
134
 
135
+ with colB:
136
+ threshold = st.slider("", 0.0, 1.0, 0.4, 0.05, label_visibility="hidden")
137
+
138
  image = np.log10(data+1)
139
  plot_image(image, scale)
140
 
 
149
  pred = np.rot90(pred, -j)
150
  y_pred += pred / 4
151
 
 
 
 
152
  # Thresholding
153
  y_pred = np.where(y_pred > threshold, y_pred, 0)
154