akhaliq HF staff commited on
Commit
5a120a8
Β·
1 Parent(s): 33eb568

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -3,6 +3,7 @@ import os
3
 
4
  os.system("wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt")
5
  os.system("wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt")
 
6
 
7
  import argparse
8
  import time
@@ -22,7 +23,7 @@ from utils.torch_utils import select_device, load_classifier, time_synchronized,
22
  from PIL import Image
23
 
24
  parser = argparse.ArgumentParser()
25
- parser.add_argument('--weights', nargs='+', type=str, default='yolov7-e6e.pt', help='model.pt path(s)')
26
  parser.add_argument('--source', type=str, default='Inference/', help='source') # file/folder, 0 for webcam
27
  parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
28
  parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
@@ -185,7 +186,7 @@ def detect(img):
185
 
186
  with torch.no_grad():
187
  if opt.update: # update all models (to fix SourceChangeWarning)
188
- for opt.weights in ['yolov7-e6e.pt']:
189
  strip_optimizer(opt.weights)
190
 
191
  gr.Interface(detect,gr.Image(type="pil"), gr.Image(type="pil"),title="Yolov7",examples=[["horses.jpeg"]],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()
 
3
 
4
  os.system("wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt")
5
  os.system("wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt")
6
+ os.system("wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6.pt")
7
 
8
  import argparse
9
  import time
 
23
  from PIL import Image
24
 
25
  parser = argparse.ArgumentParser()
26
+ parser.add_argument('--weights', nargs='+', type=str, default='yolov7-e6.pt', help='model.pt path(s)')
27
  parser.add_argument('--source', type=str, default='Inference/', help='source') # file/folder, 0 for webcam
28
  parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
29
  parser.add_argument('--conf-thres', type=float, default=0.25, help='object confidence threshold')
 
186
 
187
  with torch.no_grad():
188
  if opt.update: # update all models (to fix SourceChangeWarning)
189
+ for opt.weights in ['yolov7-e6.pt']:
190
  strip_optimizer(opt.weights)
191
 
192
  gr.Interface(detect,gr.Image(type="pil"), gr.Image(type="pil"),title="Yolov7",examples=[["horses.jpeg"]],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()