akhaliq HF staff commited on
Commit
925f5d7
β€’
1 Parent(s): f39663a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -47,12 +47,7 @@ def detect(img,model):
47
  parser.add_argument('--trace', action='store_true', help='trace model')
48
  opt = parser.parse_args()
49
  img.save("Inference/test.jpg")
50
- if model == "yolov7":
51
- opt.img_size=640
52
- source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace
53
- if model == "yolov7-e6e" or "yolov7-e6":
54
- opt.img_size=1280
55
- source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace
56
  save_img = True # save inference images
57
  webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
58
  ('rtsp://', 'rtmp://', 'http://', 'https://'))
@@ -188,4 +183,4 @@ def detect(img,model):
188
  return Image.fromarray(im0[:,:,::-1])
189
 
190
 
191
- gr.Interface(detect,[gr.Image(type="pil"),gr.Dropdown(choices=["yolov7","yolov7-e6e","yolov7-e6"])], gr.Image(type="pil"),title="Yolov7",examples=[["horses.jpeg", "yolov7"]],description="demo for <a href='https://github.com/WongKinYiu/yolov7' style='text-decoration: underline' target='_blank'>WongKinYiu/yolov7</a> Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors").launch()
 
47
  parser.add_argument('--trace', action='store_true', help='trace model')
48
  opt = parser.parse_args()
49
  img.save("Inference/test.jpg")
50
+ source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace
 
 
 
 
 
51
  save_img = True # save inference images
52
  webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
53
  ('rtsp://', 'rtmp://', 'http://', 'https://'))
 
183
  return Image.fromarray(im0[:,:,::-1])
184
 
185
 
186
+ gr.Interface(detect,[gr.Image(type="pil"),gr.Dropdown(choices=["yolov7","yolov7-e6"])], gr.Image(type="pil"),title="Yolov7",examples=[["horses.jpeg", "yolov7"]],description="demo for <a href='https://github.com/WongKinYiu/yolov7' style='text-decoration: underline' target='_blank'>WongKinYiu/yolov7</a> Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors").launch()