Aditya9790 commited on
Commit
31e8a97
1 Parent(s): 1b195ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -61,7 +61,7 @@ def draw_boxes(img, bbox, identities=None, categories=None, confidences = None,
61
  ##################################
62
 
63
 
64
- def detect(img, model):
65
  parser = argparse.ArgumentParser()
66
  parser.add_argument('--weights', nargs='+', type=str, default='yolov7.pt', help='model.pt path(s)')
67
  parser.add_argument('--source', type=str, default='inference/images', help='source') # file/folder, 0 for webcam
@@ -238,11 +238,7 @@ def detect(img, model):
238
  confidences = dets_to_sort[:, 4]
239
 
240
  im0 = draw_boxes(im0, bbox_xyxy, identities, categories, confidences, names, colors)
241
-
242
-
243
-
244
-
245
-
246
  # Print time (inference + NMS)
247
  print(f'{s}Done. ({(1E3 * (t2 - t1)):.1f}ms) Inference, ({(1E3 * (t3 - t2)):.1f}ms) NMS')
248
 
@@ -285,7 +281,7 @@ def detect(img, model):
285
  #print(f"Results saved to {save_dir}{s}")
286
 
287
  print(f'Done. ({time.time() - t0:.3f}s)')
288
- return vid_writer
289
 
290
 
291
 
 
61
  ##################################
62
 
63
 
64
+ def detect(save_img=True):
65
  parser = argparse.ArgumentParser()
66
  parser.add_argument('--weights', nargs='+', type=str, default='yolov7.pt', help='model.pt path(s)')
67
  parser.add_argument('--source', type=str, default='inference/images', help='source') # file/folder, 0 for webcam
 
238
  confidences = dets_to_sort[:, 4]
239
 
240
  im0 = draw_boxes(im0, bbox_xyxy, identities, categories, confidences, names, colors)
241
+
 
 
 
 
242
  # Print time (inference + NMS)
243
  print(f'{s}Done. ({(1E3 * (t2 - t1)):.1f}ms) Inference, ({(1E3 * (t3 - t2)):.1f}ms) NMS')
244
 
 
281
  #print(f"Results saved to {save_dir}{s}")
282
 
283
  print(f'Done. ({time.time() - t0:.3f}s)')
284
+ return img
285
 
286
 
287