mie035 commited on
Commit
894cc56
1 Parent(s): 08eadfe
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -25,7 +25,7 @@ def resize_and_show(image):
25
  cv2.waitKey(1000)
26
  cv2.destroyAllWindows()
27
 
28
- def segmentate(image):
29
  BG_COLOR = (192, 192, 192) # gray
30
  MASK_COLOR = (255, 255, 255) # white
31
 
@@ -39,8 +39,8 @@ def segmentate(image):
39
  # Loop through demo image(s)
40
 
41
  # Create the MediaPipe image file that will be segmented
42
- # image = mp.Image.create_from_file("examples/kawamura_sample.jpeg")
43
-
44
  # Retrieve the masks for the segmented image
45
  segmentation_result = segmenter.segment(image)
46
  category_mask = segmentation_result.category_mask
@@ -67,7 +67,7 @@ examples = [[f'examples/{name}', 3] for name in sorted(os.listdir('examples'))]
67
  iface = gr.Interface(
68
  fn=segmentate,
69
  inputs=[
70
- gr.Image(type='numpy', label='Input Image')
71
  ],
72
  outputs=[
73
  gr.Image(label='image segmentated')
 
25
  cv2.waitKey(1000)
26
  cv2.destroyAllWindows()
27
 
28
+ def segmentate(filepath):
29
  BG_COLOR = (192, 192, 192) # gray
30
  MASK_COLOR = (255, 255, 255) # white
31
 
 
39
  # Loop through demo image(s)
40
 
41
  # Create the MediaPipe image file that will be segmented
42
+ image = mp.Image.create_from_file(filepath)
43
+
44
  # Retrieve the masks for the segmented image
45
  segmentation_result = segmenter.segment(image)
46
  category_mask = segmentation_result.category_mask
 
67
  iface = gr.Interface(
68
  fn=segmentate,
69
  inputs=[
70
+ gr.Image(type='filepath', label='Input Image')
71
  ],
72
  outputs=[
73
  gr.Image(label='image segmentated')