Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -59,7 +59,7 @@ def Custom_detect(img,model):
|
|
59 |
source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace
|
60 |
save_img = True
|
61 |
webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(('rtsp://', 'rtmp://', 'http://', 'https://'))
|
62 |
-
save_dir = Path(increment_path(Path(opt.project)
|
63 |
set_logging()
|
64 |
device = select_device(opt.device)
|
65 |
half = device.type != 'cpu'
|
@@ -98,7 +98,7 @@ def Custom_detect(img,model):
|
|
98 |
t1 = time_synchronized()
|
99 |
pred = model(img, augment=opt.augment)[0]
|
100 |
|
101 |
-
pred = non_max_suppression(pred,
|
102 |
t2 = time_synchronized()
|
103 |
|
104 |
|
@@ -173,7 +173,6 @@ output = gr.Image(type="pil")
|
|
173 |
|
174 |
examples=[["Examples/img-300_jpg.rf.6b7b035dff1cda092ce3dc22be8d0135.jpg",'Image1']]
|
175 |
|
176 |
-
io=gr.Interface(fn=Custom_detect, inputs=inp, outputs=output, title='Pot Hole Detection With Custom YOLOv7 ',
|
177 |
-
examples=examples)
|
178 |
io.launch()
|
179 |
|
|
|
59 |
source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace
|
60 |
save_img = True
|
61 |
webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(('rtsp://', 'rtmp://', 'http://', 'https://'))
|
62 |
+
save_dir = Path(increment_path(Path(opt.project)/opt.name,exist_ok=opt.exist_ok))(save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True)
|
63 |
set_logging()
|
64 |
device = select_device(opt.device)
|
65 |
half = device.type != 'cpu'
|
|
|
98 |
t1 = time_synchronized()
|
99 |
pred = model(img, augment=opt.augment)[0]
|
100 |
|
101 |
+
pred = non_max_suppression(pred,opt.conf_thres,opt.iou_thres,classes=opt.classes, agnostic=opt.agnostic_nms)
|
102 |
t2 = time_synchronized()
|
103 |
|
104 |
|
|
|
173 |
|
174 |
examples=[["Examples/img-300_jpg.rf.6b7b035dff1cda092ce3dc22be8d0135.jpg",'Image1']]
|
175 |
|
176 |
+
io=gr.Interface(fn=Custom_detect, inputs=inp, outputs=output, title='Pot Hole Detection With Custom YOLOv7 ', examples=examples)
|
|
|
177 |
io.launch()
|
178 |
|