File size: 1,268 Bytes
7eda1e7 65c1b15 a376dac ea07644 65c1b15 a376dac 65c1b15 a376dac 1b92647 a376dac 6365d38 b4f4a50 368ef8a 6365d38 ecf579b 21181e0 0250c84 368ef8a 6365d38 0250c84 65c1b15 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
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])
description = """
<center><img src="https://huggingface.co/spaces/intelliarts/hotspot-anomaly-detection-for-solar-panels/resolve/main/images/ia_logo.png" width=270px> </center><br>
<center>This is a demo of a computer vision model designed to detect anomalies in solar panels. It operates on infrared images of solar panels. The model indicates the overheated area and the accuracy of anomaly detection. You can use your own infrared images for testing or utilize samples from our dataset</center>
"""
demo = gr.Interface(fn=detect_hotspots, inputs=gr.Image(type='pil'), outputs="image",
examples=[['images/test_image_1.jpg'], ['images/test_image_2.jpg'],
['images/test_image_3.jpg'], ['images/test_image_4.jpg']],
examples_per_page=4,
cache_examples= False,
description=description
)
demo.launch()
|