Update app.py
Browse files
app.py
CHANGED
|
@@ -117,15 +117,12 @@ if uploaded_file is not None:
|
|
| 117 |
col5.subheader("Decomposed")
|
| 118 |
|
| 119 |
with col1:
|
| 120 |
-
st.markdown("""<style>[data-baseweb="select"] {margin-top: -26px;}</style>""", unsafe_allow_html=True)
|
| 121 |
max_scale = int(data.shape[0] // 128)
|
| 122 |
-
# scale = int(st.selectbox('Scale:',[i+1 for i in range(max_scale)], label_visibility="hidden"))
|
| 123 |
scale = st.selectbox('Scale:',[f"{(i+1)*128}x{(i+1)*128}" for i in range(max_scale)], label_visibility="hidden")
|
| 124 |
scale = int(scale.split("x")[0]) // 128
|
| 125 |
-
st.markdown("""<style>[data-baseweb="select"] {margin-top: 30px;}</style>""", unsafe_allow_html=True)
|
| 126 |
|
| 127 |
with col3:
|
| 128 |
-
# st.markdown("""<style>[data-baseweb="select"] {margin-top: 16px;}</style>""", unsafe_allow_html=True)
|
| 129 |
detect = st.button('Detect')
|
| 130 |
|
| 131 |
with col5:
|
|
@@ -137,11 +134,11 @@ if uploaded_file is not None:
|
|
| 137 |
image = np.log10(data+1)
|
| 138 |
plot_image(image, scale)
|
| 139 |
|
| 140 |
-
with
|
| 141 |
st.markdown("""<style>[data-baseweb="select"] {margin-top: -36px;}</style>""", unsafe_allow_html=True)
|
| 142 |
threshold = st.slider("", 0.0, 1.0, 0.0, 0.05, label_visibility="hidden")
|
| 143 |
|
| 144 |
-
if detect
|
| 145 |
data, wcs = cut(data, wcs, scale=scale)
|
| 146 |
image = np.log10(data+1)
|
| 147 |
|
|
@@ -152,9 +149,11 @@ if uploaded_file is not None:
|
|
| 152 |
pred = np.rot90(pred, -j)
|
| 153 |
y_pred += pred / 4
|
| 154 |
|
| 155 |
-
|
|
|
|
|
|
|
| 156 |
|
| 157 |
-
plot_prediction(
|
| 158 |
|
| 159 |
with colC:
|
| 160 |
st.markdown("""<style>[data-baseweb="select"] {margin-top: -36px;}</style>""", unsafe_allow_html=True)
|
|
|
|
| 117 |
col5.subheader("Decomposed")
|
| 118 |
|
| 119 |
with col1:
|
| 120 |
+
# st.markdown("""<style>[data-baseweb="select"] {margin-top: -26px;}</style>""", unsafe_allow_html=True)
|
| 121 |
max_scale = int(data.shape[0] // 128)
|
|
|
|
| 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 col3:
|
|
|
|
| 126 |
detect = st.button('Detect')
|
| 127 |
|
| 128 |
with col5:
|
|
|
|
| 134 |
image = np.log10(data+1)
|
| 135 |
plot_image(image, scale)
|
| 136 |
|
| 137 |
+
with col4:
|
| 138 |
st.markdown("""<style>[data-baseweb="select"] {margin-top: -36px;}</style>""", unsafe_allow_html=True)
|
| 139 |
threshold = st.slider("", 0.0, 1.0, 0.0, 0.05, label_visibility="hidden")
|
| 140 |
|
| 141 |
+
if detect:
|
| 142 |
data, wcs = cut(data, wcs, scale=scale)
|
| 143 |
image = np.log10(data+1)
|
| 144 |
|
|
|
|
| 149 |
pred = np.rot90(pred, -j)
|
| 150 |
y_pred += pred / 4
|
| 151 |
|
| 152 |
+
if detect or bool(threshold):
|
| 153 |
+
|
| 154 |
+
pred = np.where(y_pred > threshold, y_pred, 0)
|
| 155 |
|
| 156 |
+
plot_prediction(pred)
|
| 157 |
|
| 158 |
with colC:
|
| 159 |
st.markdown("""<style>[data-baseweb="select"] {margin-top: -36px;}</style>""", unsafe_allow_html=True)
|