Update app.py
Browse files
app.py
CHANGED
@@ -91,23 +91,23 @@ if uploaded_file is not None:
|
|
91 |
# Add a slider to change the scale
|
92 |
with col1:
|
93 |
plot_image(np.log10(data+1), scale)
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
plot_prediction(y_pred)
|
112 |
|
113 |
# ccd = CCDData(pred, unit="adu", wcs=wcs)
|
|
|
91 |
# Add a slider to change the scale
|
92 |
with col1:
|
93 |
plot_image(np.log10(data+1), scale)
|
94 |
+
|
95 |
+
with col2:
|
96 |
+
if st.button('Detect cavities'):
|
97 |
+
data, wcs = cut(data, wcs, scale=scale)
|
98 |
+
|
99 |
+
image = np.log10(data+1)
|
100 |
+
|
101 |
+
y_pred = 0
|
102 |
+
for j in [0,1,2,3]:
|
103 |
+
rotated = np.rot90(image, j)
|
104 |
+
pred = model.predict(rotated.reshape(1, 128, 128, 1)).reshape(128 ,128)
|
105 |
+
pred = np.rot90(pred, -j)
|
106 |
+
y_pred += pred / 4
|
107 |
+
|
108 |
+
# Thresholding
|
109 |
+
y_pred = np.where(y_pred > 0.4, y_pred, 0)
|
110 |
+
|
111 |
plot_prediction(y_pred)
|
112 |
|
113 |
# ccd = CCDData(pred, unit="adu", wcs=wcs)
|