Update app.py
Browse files
app.py
CHANGED
|
@@ -48,17 +48,24 @@ def plot_outlines(img, masks):
|
|
| 48 |
for o in outpix:
|
| 49 |
ax.plot(o[:,0], img.shape[0]-o[:,1], color=[1,0,0], lw=1)
|
| 50 |
ax.axis('off')
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
bytes_image.
|
| 54 |
-
|
| 55 |
-
bytes_image.
|
| 56 |
-
|
| 57 |
-
img = cv2.
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
def plot_overlay(img, masks):
|
| 64 |
img = normalize99(img.astype(np.float32).mean(axis=-1))
|
|
@@ -137,7 +144,7 @@ with gr.Blocks(title = "Hello",
|
|
| 137 |
|
| 138 |
with gr.Column(scale=1):
|
| 139 |
img_overlay = gr.Image(label = "Output image", type = "numpy")
|
| 140 |
-
img_outlines = gr.Image(label = "Output image", type = "
|
| 141 |
flows = gr.Image(label = "Output image", type = "numpy")
|
| 142 |
masks = gr.Image(label = "Output image", type = "numpy")
|
| 143 |
|
|
|
|
| 48 |
for o in outpix:
|
| 49 |
ax.plot(o[:,0], img.shape[0]-o[:,1], color=[1,0,0], lw=1)
|
| 50 |
ax.axis('off')
|
| 51 |
+
|
| 52 |
+
#bytes_image = io.BytesIO()
|
| 53 |
+
#plt.savefig(bytes_image, format='png', facecolor=fig.get_facecolor(), edgecolor='none')
|
| 54 |
+
#bytes_image.seek(0)
|
| 55 |
+
#img_arr = np.frombuffer(bytes_image.getvalue(), dtype=np.uint8)
|
| 56 |
+
#bytes_image.close()
|
| 57 |
+
#img = cv2.imdecode(img_arr, 1)
|
| 58 |
+
#img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
|
| 59 |
+
#del bytes_image
|
| 60 |
+
#fig.clf()
|
| 61 |
+
#plt.close(fig)
|
| 62 |
+
|
| 63 |
+
img = plt.gcf()
|
| 64 |
+
buf = io.BytesIO()
|
| 65 |
+
figure.savefig(buf, bbox_inches='tight')
|
| 66 |
+
buf.seek(0)
|
| 67 |
+
output_pil_img = Image.open(buf)
|
| 68 |
+
return output_pil_img
|
| 69 |
|
| 70 |
def plot_overlay(img, masks):
|
| 71 |
img = normalize99(img.astype(np.float32).mean(axis=-1))
|
|
|
|
| 144 |
|
| 145 |
with gr.Column(scale=1):
|
| 146 |
img_overlay = gr.Image(label = "Output image", type = "numpy")
|
| 147 |
+
img_outlines = gr.Image(label = "Output image", type = "pil")
|
| 148 |
flows = gr.Image(label = "Output image", type = "numpy")
|
| 149 |
masks = gr.Image(label = "Output image", type = "numpy")
|
| 150 |
|