Plsek commited on
Commit
8e54123
·
1 Parent(s): 4514163

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -4,7 +4,7 @@ model = from_pretrained_keras("Plsek/CADET-v1")
4
 
5
  # Basic libraries
6
  import os
7
- import shutil
8
  import numpy as np
9
  from scipy.ndimage import center_of_mass
10
  import matplotlib.pyplot as plt
@@ -164,7 +164,7 @@ if uploaded_file is not None:
164
  st.markdown("""<style>[data-baseweb="select"] {margin-top: -36px;}</style>""", unsafe_allow_html=True)
165
  threshold = st.slider("", 0.0, 1.0, 0.0, 0.05, label_visibility="hidden")
166
 
167
- if detect:
168
  data, wcs = cut(data, wcs, scale=scale)
169
  image = np.log10(data+1)
170
 
@@ -175,12 +175,12 @@ if uploaded_file is not None:
175
  pred = np.rot90(pred, -j)
176
  y_pred += pred / 4
177
 
178
- np.save("pred.npy", y_pred)
179
 
180
- try: y_pred = np.load("pred.npy")
181
- except: y_pred = np.zeros((128,128))
182
- # try: y_pred
183
  # except: y_pred = np.zeros((128,128))
 
 
184
  y_pred_th = np.where(y_pred > threshold, y_pred, 0)
185
  # np.save("thresh.npy", y_pred)
186
 
 
4
 
5
  # Basic libraries
6
  import os
7
+ # import shutil
8
  import numpy as np
9
  from scipy.ndimage import center_of_mass
10
  import matplotlib.pyplot as plt
 
164
  st.markdown("""<style>[data-baseweb="select"] {margin-top: -36px;}</style>""", unsafe_allow_html=True)
165
  threshold = st.slider("", 0.0, 1.0, 0.0, 0.05, label_visibility="hidden")
166
 
167
+ if detect or threshold:
168
  data, wcs = cut(data, wcs, scale=scale)
169
  image = np.log10(data+1)
170
 
 
175
  pred = np.rot90(pred, -j)
176
  y_pred += pred / 4
177
 
178
+ # np.save("pred.npy", y_pred)
179
 
180
+ # try: y_pred = np.load("pred.npy")
 
 
181
  # except: y_pred = np.zeros((128,128))
182
+ try: y_pred
183
+ except: y_pred = np.zeros((128,128))
184
  y_pred_th = np.where(y_pred > threshold, y_pred, 0)
185
  # np.save("thresh.npy", y_pred)
186