mirari commited on
Commit
1156e83
·
1 Parent(s): b44b575

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -13,10 +13,10 @@ state_dict = torch.load('fasterRCNNKangaroo.pth', map_location=torch.device('cpu
13
  model.load_state_dict(state_dict)
14
  size = 384
15
 
 
16
  def predict(img):
17
  img = PILImage.create(img)
18
- infer_tfms = tfms.A.Adapter([*tfms.A.resize_and_pad(size),tfms.A.Normalize()])
19
  pred_dict = models.torchvision.faster_rcnn.end2end_detect(img, infer_tfms, model.to("cpu"), class_map=class_map, detection_threshold=0.5)
20
- return pred_dict
21
 
22
  gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(128,128)), outputs=gr.outputs.Image(),examples=['00001.jpg','00002.jpg']).launch(share=False)
 
13
  model.load_state_dict(state_dict)
14
  size = 384
15
 
16
+ infer_tfms = tfms.A.Adapter([*tfms.A.resize_and_pad(size),tfms.A.Normalize()])
17
  def predict(img):
18
  img = PILImage.create(img)
 
19
  pred_dict = models.torchvision.faster_rcnn.end2end_detect(img, infer_tfms, model.to("cpu"), class_map=class_map, detection_threshold=0.5)
20
+ return pred_dict['img']
21
 
22
  gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(128,128)), outputs=gr.outputs.Image(),examples=['00001.jpg','00002.jpg']).launch(share=False)