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

Update app.py

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