File size: 739 Bytes
7eda1e7
65c1b15
a376dac
ea07644
65c1b15
a376dac
65c1b15
a376dac
 
 
 
 
 
1b92647
a376dac
 
a785cd5
 
 
 
65c1b15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import cv2
import gradio as gr
from ultralytics import YOLO
from PIL import Image

model = YOLO('hotspot_detector.pt')

def detect_hotspots(image):
    result = model(image)
    
    for r in result:
        im_array = r.plot()
        # im = Image.fromarray(im_array[..., ::-1])
        return Image.fromarray(im_array[..., ::-1])


demo = gr.Interface(fn=detect_hotspots, inputs=gr.Image(type='pil'), outputs="image", title="YOLO Object Detection",
                    examples=[['Test Case 1', 'images/test_image_1.jpg'], ['Test Case 2', 'images/test_image_2.jpg'],
                              ['Test Case 3', 'images/test_image_3.jpg'], ['Test Case 4', 'images/test_image_4.jpg']],
             cache_examples= False,)
demo.launch()