Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,7 @@ from utils.general import check_img_size, check_requirements, check_imshow, non_
|
|
18 |
scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path
|
19 |
from utils.plots import plot_one_box
|
20 |
from utils.torch_utils import select_device, load_classifier, time_synchronized, TracedModel
|
|
|
21 |
|
22 |
parser = argparse.ArgumentParser()
|
23 |
parser.add_argument('--weights', nargs='+', type=str, default='yolov7.pt', help='model.pt path(s)')
|
@@ -179,11 +180,11 @@ def detect(img):
|
|
179 |
|
180 |
print(f'Done. ({time.time() - t0:.3f}s)')
|
181 |
|
182 |
-
return im0
|
183 |
|
184 |
with torch.no_grad():
|
185 |
if opt.update: # update all models (to fix SourceChangeWarning)
|
186 |
for opt.weights in ['yolov7.pt']:
|
187 |
strip_optimizer(opt.weights)
|
188 |
|
189 |
-
gr.Interface(detect,gr.Image(type="pil"), gr.Image(type="
|
|
|
18 |
scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path
|
19 |
from utils.plots import plot_one_box
|
20 |
from utils.torch_utils import select_device, load_classifier, time_synchronized, TracedModel
|
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)')
|
|
|
180 |
|
181 |
print(f'Done. ({time.time() - t0:.3f}s)')
|
182 |
|
183 |
+
return Image.fromarray(im0)
|
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")).launch()
|