asalhi85 commited on
Commit
c7e2f5d
1 Parent(s): de4171c

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -48,16 +48,16 @@ def inference(image_url, image, min_score):
48
  if r:
49
  im = np.frombuffer(r.content, dtype="uint8")
50
  im = cv2.imdecode(im, cv2.IMREAD_COLOR)
51
- # else:
52
- # # Model expect BGR!
53
- # im = image[:,:,::-1]
54
 
55
  cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = min_score
56
  predictor = DefaultPredictor(cfg)
57
 
58
  outputs = predictor(image)
59
 
60
- v = Visualizer(image[:,:,::-1], my_metadata, scale=1.2, instance_mode=ColorMode.IMAGE )
61
  out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
62
 
63
  return out.get_image()
 
48
  if r:
49
  im = np.frombuffer(r.content, dtype="uint8")
50
  im = cv2.imdecode(im, cv2.IMREAD_COLOR)
51
+ else:
52
+ # Model expect BGR!
53
+ im = image[:,:,::-1]
54
 
55
  cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = min_score
56
  predictor = DefaultPredictor(cfg)
57
 
58
  outputs = predictor(image)
59
 
60
+ v = Visualizer(im, my_metadata, scale=1.2, instance_mode=ColorMode.IMAGE )
61
  out = v.draw_instance_predictions(outputs["instances"].to("cpu"))
62
 
63
  return out.get_image()