Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -73,14 +73,15 @@ def segment_everything(
|
|
73 |
rect = patches.Rectangle((x1, y1), x2-x1, y2-y1, linewidth=2, edgecolor='r', facecolor='none')
|
74 |
ax.add_patch(rect)
|
75 |
|
76 |
-
print('Done till here')
|
77 |
ax.axis('off')
|
78 |
buf = io.BytesIO()
|
79 |
-
plt.savefig(buf, format='
|
80 |
plt.close(fig)
|
81 |
buf.seek(0)
|
82 |
|
83 |
cropped_image = Image.open(buf)
|
|
|
|
|
84 |
|
85 |
return fig,cropped_image
|
86 |
|
@@ -100,7 +101,7 @@ css = "h1 { text-align: center } .about { text-align: justify; padding-left: 10%
|
|
100 |
demo = gr.Interface(
|
101 |
segment_everything,
|
102 |
inputs = [
|
103 |
-
gr.Image(label="Input",
|
104 |
gr.components.Slider(minimum=512,maximum=1024,value=1024,step=64,label='Input_size',info='Our model was trained on a size of 1024'),
|
105 |
gr.Checkbox(value=True, label='withContours', info='draw the edges of the masks')
|
106 |
],
|
|
|
73 |
rect = patches.Rectangle((x1, y1), x2-x1, y2-y1, linewidth=2, edgecolor='r', facecolor='none')
|
74 |
ax.add_patch(rect)
|
75 |
|
|
|
76 |
ax.axis('off')
|
77 |
buf = io.BytesIO()
|
78 |
+
plt.savefig(buf, format='jpg', bbox_inches='tight', pad_inches=0)
|
79 |
plt.close(fig)
|
80 |
buf.seek(0)
|
81 |
|
82 |
cropped_image = Image.open(buf)
|
83 |
+
print(cropped_image)
|
84 |
+
print('Done till here')
|
85 |
|
86 |
return fig,cropped_image
|
87 |
|
|
|
101 |
demo = gr.Interface(
|
102 |
segment_everything,
|
103 |
inputs = [
|
104 |
+
gr.Image(label="Input", type='pil'),
|
105 |
gr.components.Slider(minimum=512,maximum=1024,value=1024,step=64,label='Input_size',info='Our model was trained on a size of 1024'),
|
106 |
gr.Checkbox(value=True, label='withContours', info='draw the edges of the masks')
|
107 |
],
|