Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
# ---- Overheat Detection Logic ----
|
| 4 |
+
def detect_overheat(temp, humidity, solar_output):
|
| 5 |
+
"""
|
| 6 |
+
Detects overheat fault in a smart pole.
|
| 7 |
+
Uses simple rule: if temperature > 50°C, flag as overheat.
|
| 8 |
+
Future scope: Add ML model here (e.g., IsolationForest or AutoEncoder).
|
| 9 |
+
"""
|
| 10 |
+
if temp > 50:
|
| 11 |
+
return "🔥 Overheat Detected"
|
| 12 |
+
else:
|
| 13 |
+
return "✅ Normal"
|
| 14 |
+
|
| 15 |
+
# ---- Gradio Interface ----
|
| 16 |
+
interface = gr.Interface(
|
| 17 |
+
fn=detect_overheat,
|
| 18 |
+
inputs=[
|
| 19 |
+
gr.Number(label="Temperature (°C)"),
|
| 20 |
+
gr.Number(label="Humidity (%)"),
|
| 21 |
+
gr.Number(label="Solar Output (Watts)")
|
| 22 |
+
],
|
| 23 |
+
outputs=gr.Text(label="Fault Detection Result"),
|
| 24 |
+
title="VIEP Overheat Detection - Smart Pole Fault Monitor",
|
| 25 |
+
description=(
|
| 26 |
+
"This tool detects overheating faults in Vedavathi Intelligent Energy Poles "
|
| 27 |
+
"(VIEP) based on sensor readings from each pole. "
|
| 28 |
+
"Enter temperature, humidity, and solar power output to check for overheating faults."
|
| 29 |
+
),
|
| 30 |
+
theme="default"
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
# ---- Launch the App ----
|
| 34 |
+
if __name__ == "__main__":
|
| 35 |
+
interface.launch()
|