Abijith commited on
Commit
a38d1b2
1 Parent(s): ad675b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -18
app.py CHANGED
@@ -13,21 +13,7 @@ from per_segment_anything import sam_model_registry, SamPredictor
13
  parser = argparse.ArgumentParser()
14
  parser.add_argument("-op", "--output-path", type=str, default='default')
15
  args = parser.parse_args()
16
-
17
-
18
- class ImageMask(gr.components.Image):
19
- """
20
- Sets: source="canvas", tool="sketch"
21
- """
22
-
23
- is_template = True
24
-
25
- def __init__(self, **kwargs):
26
- super().__init__(source="upload", tool='select', interactive=True, **kwargs)
27
-
28
- def preprocess(self, x):
29
- return super().preprocess(x)
30
-
31
 
32
  def point_selection(mask_sim, topk=1):
33
  # Top-1 point selection
@@ -150,10 +136,10 @@ def inference_scribble(image):
150
  Image.fromarray((mask_colors ).astype('uint8'), 'RGB')]
151
 
152
  demo = gr.Interface(fn=inference_scribble,
153
- inputs=gr.ImageMask(label="[Stroke] Draw on Image", type='pil'),
154
  outputs=[
155
- gr.outputs.Image(type="pil", label="Mask with Image"),
156
- gr.outputs.Image(type="pil", label="Mask")
157
  ],
158
  title="SAM based Segment Annotator.",
159
  description='Sketch the portion where you want to create Mask.',
 
13
  parser = argparse.ArgumentParser()
14
  parser.add_argument("-op", "--output-path", type=str, default='default')
15
  args = parser.parse_args()
16
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  def point_selection(mask_sim, topk=1):
19
  # Top-1 point selection
 
136
  Image.fromarray((mask_colors ).astype('uint8'), 'RGB')]
137
 
138
  demo = gr.Interface(fn=inference_scribble,
139
+ inputs=gr.Image(label="[Stroke] Draw on Image", tool='sketch',type='pil'),
140
  outputs=[
141
+ gr.Image(type="pil", label="Mask with Image"),
142
+ gr.Image(type="pil", label="Mask")
143
  ],
144
  title="SAM based Segment Annotator.",
145
  description='Sketch the portion where you want to create Mask.',