Spaces:
Runtime error
Runtime error
updated app
Browse files
app.py
CHANGED
@@ -26,6 +26,14 @@ def segment_sidewalk(image):
|
|
26 |
save_image(prediction, 'mask.png', cmap='gray')
|
27 |
return Image.open('image.png'), Image.open('mask.png'), Image.open('prob.png')
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
with gr.Blocks() as demo:
|
30 |
with gr.Row():
|
31 |
with gr.Column():
|
|
|
26 |
save_image(prediction, 'mask.png', cmap='gray')
|
27 |
return Image.open('image.png'), Image.open('mask.png'), Image.open('prob.png')
|
28 |
|
29 |
+
def save_image(image, path, **kwargs):
|
30 |
+
plt.figure(figsize=(8, 8))
|
31 |
+
plt.imshow(image, interpolation='nearest', **kwargs)
|
32 |
+
plt.axis('off')
|
33 |
+
plt.tight_layout()
|
34 |
+
plt.savefig(path, bbox_inches='tight', pad_inches=0)
|
35 |
+
plt.close()
|
36 |
+
|
37 |
with gr.Blocks() as demo:
|
38 |
with gr.Row():
|
39 |
with gr.Column():
|