Ubuntu
commited on
Commit
•
347886f
1
Parent(s):
bae2e21
added initial app version
Browse files- app.py +31 -0
- images/test_image_1.png +0 -0
- images/test_image_2.png +0 -0
- images/test_image_3.png +0 -0
- images/test_image_4.png +0 -0
- requirements.txt +1 -0
app.py
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import cv2
|
2 |
+
import gradio as gr
|
3 |
+
from ultralytics import YOLO
|
4 |
+
from PIL import Image
|
5 |
+
|
6 |
+
model = YOLO('wind_turbine_anomaly_detector.pt')
|
7 |
+
|
8 |
+
def detect_turbine_anomaly(image):
|
9 |
+
result = model(image)
|
10 |
+
|
11 |
+
for r in result:
|
12 |
+
im_array = r.plot()
|
13 |
+
# im = Image.fromarray(im_array[..., ::-1])
|
14 |
+
return Image.fromarray(im_array[..., ::-1])
|
15 |
+
|
16 |
+
|
17 |
+
|
18 |
+
# description = """
|
19 |
+
# <center><img src="https://huggingface.co/spaces/intelliarts/hotspot-anomaly-detection-for-solar-panels/resolve/main/images/ia_logo.png" width=270px> </center><br>
|
20 |
+
# <p style="font-size: 20px; text-align: center;"">This is a demo of a computer vision model by Intelliarts. It's designed to detect anomalies in solar panels, in particular, overheated spots. The model operates on infrared images of solar panels. It indicates the overheated spot, outlines its area, and shows the approximate accuracy of anomaly detection. You can use your own infrared images for testing or utilize samples from our dataset. This demo is not a finished ML solution, but rather a proof of concept. It can be extended to detect other anomalies in solar panels as well as visible damages.</p>
|
21 |
+
# """
|
22 |
+
|
23 |
+
|
24 |
+
demo = gr.Interface(fn=detect_turbine_anomaly, inputs=gr.Image(type='pil'), outputs="image",
|
25 |
+
examples=[['images/test_image_1.jpg'], ['images/test_image_2.jpg'],
|
26 |
+
['images/test_image_3.jpg'], ['images/test_image_4.jpg']],
|
27 |
+
examples_per_page=4,
|
28 |
+
cache_examples= False,
|
29 |
+
# description=description
|
30 |
+
)
|
31 |
+
demo.launch()
|
images/test_image_1.png
ADDED
images/test_image_2.png
ADDED
images/test_image_3.png
ADDED
images/test_image_4.png
ADDED
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
ultralytics
|