Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
from
|
4 |
-
from services.detection_service import detect_objects
|
5 |
-
from services.thermal_service import detect_thermal_anomalies
|
6 |
-
from services.shadow_detection import detect_shadow_coverage
|
7 |
-
from services.salesforce_dispatcher import send_to_salesforce
|
8 |
|
9 |
-
|
|
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
alert_payload = {
|
20 |
-
"detections": detections,
|
21 |
-
"thermal": bool(thermal),
|
22 |
-
"shadow_issue": shadow_flag,
|
23 |
-
}
|
24 |
-
send_to_salesforce(alert_payload)
|
25 |
-
return frame
|
26 |
-
except StopIteration:
|
27 |
-
|
28 |
-
return None
|
29 |
-
|
30 |
-
iface = gr.Interface(fn=monitor_feed, inputs=[], outputs="image", live=True, title="Solar
|
31 |
-
Surveillance Feed Simulation")
|
32 |
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from utils.detector import detect_faults
|
3 |
+
from PIL import Image
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
def analyze_image(image):
|
6 |
+
results = detect_faults(image)
|
7 |
+
return results
|
8 |
|
9 |
+
demo = gr.Interface(
|
10 |
+
fn=analyze_image,
|
11 |
+
inputs=gr.Image(type="pil"),
|
12 |
+
outputs="json",
|
13 |
+
title="VIEP Smart Pole Fault Detection",
|
14 |
+
description="Upload a surveillance image to detect faults like intrusion, overheating, or dust/shade issues."
|
15 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
if __name__ == "__main__":
|
18 |
+
demo.launch()
|