Spaces:
Sleeping
Sleeping
ddovidovich
commited on
Commit
·
3ff0551
1
Parent(s):
3a0efcc
Update app.py
Browse files
app.py
CHANGED
@@ -100,30 +100,30 @@ if image_file is not None:
|
|
100 |
|
101 |
st.text("DONE ! ....")
|
102 |
|
103 |
-
if image_file is not None:
|
104 |
-
img=load_image(image_file)
|
105 |
-
|
106 |
-
st.text("Making A Prediction ....")
|
107 |
-
st.image(img,width=850)
|
108 |
-
|
109 |
-
img=np.asarray(img)
|
110 |
-
|
111 |
-
img_cv=convert_one_channel(img)
|
112 |
-
img_cv=cv2.resize(img_cv,(512,512), interpolation=cv2.INTER_LANCZOS4)
|
113 |
-
img_cv=np.float32(img_cv/255)
|
114 |
-
|
115 |
-
img_cv=np.reshape(img_cv,(1,512,512,1))
|
116 |
-
predict_img=model.predict(img_cv)
|
117 |
# predict=predict_img[1,:,:,0]
|
118 |
-
plt.imsave("predict.png",predict_img)
|
119 |
-
|
120 |
-
## Plotting - Пример результата
|
121 |
-
img = cv2.imread(image_file)
|
122 |
-
|
123 |
-
predict1 = cv2.resize(predict_img, (img.shape[1], img.shape[0]), interpolation=cv2.INTER_LANCZOS4)
|
124 |
-
|
125 |
-
mask = np.uint8(predict1 * 255)
|
126 |
-
_, mask = cv2.threshold(mask, thresh=255/2, maxval=255, type=cv2.THRESH_BINARY)
|
127 |
-
cnts, hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
128 |
-
img = cv2.drawContours(img, cnts, -1, (255, 0, 0), 2)
|
129 |
-
cv2_imshow(img)
|
|
|
100 |
|
101 |
st.text("DONE ! ....")
|
102 |
|
103 |
+
#if image_file is not None:
|
104 |
+
# img=load_image(image_file)
|
105 |
+
#
|
106 |
+
# st.text("Making A Prediction ....")
|
107 |
+
# st.image(img,width=850)
|
108 |
+
#
|
109 |
+
# img=np.asarray(img)
|
110 |
+
#
|
111 |
+
# img_cv=convert_one_channel(img)
|
112 |
+
# img_cv=cv2.resize(img_cv,(512,512), interpolation=cv2.INTER_LANCZOS4)
|
113 |
+
# img_cv=np.float32(img_cv/255)
|
114 |
+
#
|
115 |
+
# img_cv=np.reshape(img_cv,(1,512,512,1))
|
116 |
+
# predict_img=model.predict(img_cv)
|
117 |
# predict=predict_img[1,:,:,0]
|
118 |
+
# plt.imsave("predict.png",predict_img)
|
119 |
+
#
|
120 |
+
# ## Plotting - Пример результата
|
121 |
+
# img = cv2.imread(image_file)
|
122 |
+
#
|
123 |
+
# predict1 = cv2.resize(predict_img, (img.shape[1], img.shape[0]), interpolation=cv2.INTER_LANCZOS4)
|
124 |
+
#
|
125 |
+
# mask = np.uint8(predict1 * 255)
|
126 |
+
# _, mask = cv2.threshold(mask, thresh=255/2, maxval=255, type=cv2.THRESH_BINARY)
|
127 |
+
# cnts, hierarchy = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
|
128 |
+
# img = cv2.drawContours(img, cnts, -1, (255, 0, 0), 2)
|
129 |
+
# cv2_imshow(img)
|