Plsek commited on
Commit
983a306
·
1 Parent(s): 7d21ed6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -98,11 +98,11 @@ def decompose_cavity(pred, th2=0.7, amin=10):
98
  xi, yi = X[b], Y[b]
99
  img[xi, yi] = pred[xi, yi]
100
 
101
- # THRESHOLDING #2
102
- if not (img > th2).any(): continue
103
 
104
- # MINIMAL AREA
105
- if np.sum(img) <= amin: continue
106
 
107
  cavities.append(img)
108
 
@@ -114,6 +114,7 @@ def decompose_cavity(pred, th2=0.7, amin=10):
114
  bordersize = 0.6
115
  _, col, _ = st.columns([bordersize, 3, bordersize])
116
 
 
117
  # os.system("rm -r predictions")
118
  # os.system("rm predictions.zip Views")
119
  # os.system("mkdir -p predictions")
@@ -174,12 +175,12 @@ if uploaded_file is not None:
174
  pred = np.rot90(pred, -j)
175
  y_pred += pred / 4
176
 
177
- # np.save("pred.npy", y_pred)
178
 
179
- # try: y_pred = np.load("pred.npy")
180
- # except: y_pred = np.zeros((128,128))
181
- try: y_pred
182
  except: y_pred = np.zeros((128,128))
 
 
183
  y_pred_th = np.where(y_pred > threshold, y_pred, 0)
184
  # np.save("thresh.npy", y_pred)
185
 
 
98
  xi, yi = X[b], Y[b]
99
  img[xi, yi] = pred[xi, yi]
100
 
101
+ # # THRESHOLDING #2
102
+ # if not (img > th2).any(): continue
103
 
104
+ # # MINIMAL AREA
105
+ # if np.sum(img) <= amin: continue
106
 
107
  cavities.append(img)
108
 
 
114
  bordersize = 0.6
115
  _, col, _ = st.columns([bordersize, 3, bordersize])
116
 
117
+ if os.path.exists("pred.npy"): os.system("rm pred.npy")
118
  # os.system("rm -r predictions")
119
  # os.system("rm predictions.zip Views")
120
  # os.system("mkdir -p predictions")
 
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