Ubuntu commited on
Commit
ea07644
·
1 Parent(s): 57b5784

added Image construction

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  from ultralytics import YOLO
 
3
 
4
  model = YOLO('hotspot_detector.pt')
5
 
@@ -9,7 +10,7 @@ def detect_hotspots(image):
9
  for r in result:
10
  im_array = r.plot()
11
  # im = Image.fromarray(im_array[..., ::-1])
12
- return im_array[..., ::-1]
13
 
14
 
15
  demo = gr.Interface(fn=detect_hotspots, inputs=gr.Image(), outputs="image", title="YOLO Object Detection")
 
1
  import gradio as gr
2
  from ultralytics import YOLO
3
+ from PIL import Image
4
 
5
  model = YOLO('hotspot_detector.pt')
6
 
 
10
  for r in result:
11
  im_array = r.plot()
12
  # im = Image.fromarray(im_array[..., ::-1])
13
+ return Image.fromarray(im_array[..., ::-1])
14
 
15
 
16
  demo = gr.Interface(fn=detect_hotspots, inputs=gr.Image(), outputs="image", title="YOLO Object Detection")