Sanan commited on
Commit
0933eb5
·
1 Parent(s): 1270153

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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 yolo(im):
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(im) # inference
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(im, inputs, outputs, title=title, theme="huggingface").launch(debug=True)
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