Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,11 @@ from PIL import Image
|
|
5 |
|
6 |
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt', force_reload=True)
|
7 |
|
8 |
-
def
|
9 |
#g = (size / max(im.size)) # gain
|
10 |
# im = im.resize((int(x * g) for x in im.size), Image.ANTIALIAS) # resize
|
11 |
|
12 |
-
results = model(
|
13 |
results.render() # updates results.imgs with boxes and labels
|
14 |
return Image.fromarray(results.imgs[0])
|
15 |
|
@@ -20,5 +20,5 @@ outputs = gr.outputs.Image(type="pil", label="Output Image")
|
|
20 |
title = "Object detection from Infrared image using YOLOv5n"
|
21 |
|
22 |
|
23 |
-
gr.Interface(
|
24 |
|
|
|
5 |
|
6 |
model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt', force_reload=True)
|
7 |
|
8 |
+
def detect(image):
|
9 |
#g = (size / max(im.size)) # gain
|
10 |
# im = im.resize((int(x * g) for x in im.size), Image.ANTIALIAS) # resize
|
11 |
|
12 |
+
results = model(image) # inference
|
13 |
results.render() # updates results.imgs with boxes and labels
|
14 |
return Image.fromarray(results.imgs[0])
|
15 |
|
|
|
20 |
title = "Object detection from Infrared image using YOLOv5n"
|
21 |
|
22 |
|
23 |
+
gr.Interface(detect, inputs, outputs, title=title, theme="huggingface").launch(debug=True)
|
24 |
|