Update app.py
Browse files
app.py
CHANGED
|
@@ -91,6 +91,23 @@ def predict_on_train(image, mask):
|
|
| 91 |
|
| 92 |
# Steps to get prediction of the satellite image
|
| 93 |
mask_resized = resize_image(mask)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
# Steps to get prediction of the satellite image
|
| 96 |
sample_image_resized = resize_image(image)
|
|
@@ -124,7 +141,7 @@ def predict_on_train(image, mask):
|
|
| 124 |
# Close the figure to release resources
|
| 125 |
plt.close(fig)
|
| 126 |
|
| 127 |
-
return
|
| 128 |
|
| 129 |
def predict_on_test(image):
|
| 130 |
|
|
|
|
| 91 |
|
| 92 |
# Steps to get prediction of the satellite image
|
| 93 |
mask_resized = resize_image(mask)
|
| 94 |
+
|
| 95 |
+
# Create a figure
|
| 96 |
+
fig, ax = plt.subplots()
|
| 97 |
+
|
| 98 |
+
# Display the image
|
| 99 |
+
ax.imshow(mask_resized)
|
| 100 |
+
|
| 101 |
+
# Convert the figure to a PIL Image
|
| 102 |
+
image_buffer = io.BytesIO()
|
| 103 |
+
plt.savefig(image_buffer, format='png')
|
| 104 |
+
image_buffer.seek(0)
|
| 105 |
+
mask_pil = Image.open(image_buffer)
|
| 106 |
+
|
| 107 |
+
# Close the figure to release resources
|
| 108 |
+
plt.close(fig)
|
| 109 |
+
|
| 110 |
+
# ----------------------------------------------
|
| 111 |
|
| 112 |
# Steps to get prediction of the satellite image
|
| 113 |
sample_image_resized = resize_image(image)
|
|
|
|
| 141 |
# Close the figure to release resources
|
| 142 |
plt.close(fig)
|
| 143 |
|
| 144 |
+
return mask_pil, image_pil
|
| 145 |
|
| 146 |
def predict_on_test(image):
|
| 147 |
|