rashmi commited on
Commit
198a05b
1 Parent(s): 9324d64

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -1,10 +1,8 @@
1
  import os
2
  os.system('pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html')
3
-
4
- import gradio as gr
5
- import cv2
6
  os.system('pip install torch==1.9.0 torchvision==0.10.0')
7
 
 
8
  # check pytorch installation:
9
  import torch, torchvision
10
  print(torch.__version__, torch.cuda.is_available())
@@ -43,8 +41,7 @@ predictor = DefaultPredictor(cfg)
43
 
44
 
45
  def inference(img):
46
- # im = cv2.imread(img.name)
47
- im = cv2.imread(img)
48
  outputs = predictor(im)
49
 
50
  take = outputs['instances'].scores >= 0.5 #Threshold
 
1
  import os
2
  os.system('pip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu102/torch1.9/index.html')
 
 
 
3
  os.system('pip install torch==1.9.0 torchvision==0.10.0')
4
 
5
+ import gradio as gr
6
  # check pytorch installation:
7
  import torch, torchvision
8
  print(torch.__version__, torch.cuda.is_available())
 
41
 
42
 
43
  def inference(img):
44
+ im = np.asarray(Image.open(img).convert('RGB'))
 
45
  outputs = predictor(im)
46
 
47
  take = outputs['instances'].scores >= 0.5 #Threshold