akhaliq HF staff commited on
Commit
3b10901
1 Parent(s): ac0cd05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import os
2
  import sys
 
3
 
4
  os.system('pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html')
5
 
@@ -44,6 +45,7 @@ os.system("wget https://i.imgur.com/Vj17K5z.jpg")
44
 
45
  def inference(img):
46
  im = cv2.imread(img)
 
47
  outputs = predictor(im)
48
  v = Visualizer(im[:, :, ::-1], coco_metadata, scale=1.2, instance_mode=ColorMode.IMAGE_BW)
49
  panoptic_result = v.draw_panoptic_seg(outputs["panoptic_seg"][0].to("cpu"), outputs["panoptic_seg"][1]).get_image()
1
  import os
2
  import sys
3
+ os.system("pip install imutils")
4
 
5
  os.system('pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html')
6
 
45
 
46
  def inference(img):
47
  im = cv2.imread(img)
48
+ im = imutils.resize(im, width=512)
49
  outputs = predictor(im)
50
  v = Visualizer(im[:, :, ::-1], coco_metadata, scale=1.2, instance_mode=ColorMode.IMAGE_BW)
51
  panoptic_result = v.draw_panoptic_seg(outputs["panoptic_seg"][0].to("cpu"), outputs["panoptic_seg"][1]).get_image()