File size: 1,513 Bytes
3f7c605
 
 
53a1b66
3f7c605
 
 
53a1b66
3f7c605
 
 
53a1b66
3f7c605
53a1b66
3f7c605
 
 
 
 
53a1b66
b3a117b
 
 
3f7c605
b3a117b
 
3f7c605
 
 
53a1b66
b3a117b
 
3f7c605
 
 
 
 
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
33
34
35
36
37
38
import gradio as gr

# ---- Overheat Detection Logic ----
def detect_overheat(area, temp, humidity, solar_output):
    """
    Detects overheat fault in a smart pole.
    Uses simple rule: if temperature > 50°C, flag as overheat.
    Displays the area name when the fault is detected.
    Future scope: Add ML model here (e.g., IsolationForest or AutoEncoder).
    """
    if temp > 50:
        return f"Area: {area} - 🔥 Overheat Detected"
    else:
        return f"Area: {area} - ✅ Normal"

# ---- Gradio Interface ----
interface = gr.Interface(
    fn=detect_overheat,
    inputs=[
        gr.Textbox(label="Area Name", placeholder="Enter the area name (e.g., Ramanthapur, Hyderabad)"),  # Area input
        gr.Number(label="Temperature (°C)"),  # Temperature input
        gr.Number(label="Humidity (%)"),      # Humidity input
        gr.Number(label="Solar Output (Watts)")  # Solar Output input
    ],
    outputs=gr.Text(label="Fault Detection Result"),  # Output for fault detection
    title="VIEP Overheat Detection - Smart Pole Fault Monitor",  # Title of the app
    description=(
        "This tool detects overheating faults in Vedavathi Intelligent Energy Poles "
        "(VIEP) based on sensor readings from each pole. "
        "Enter the area name, temperature, humidity, and solar power output to check for overheating faults."
    ),  # Description of how the app works
    theme="default"  # App theme
)

# ---- Launch the App ----
if __name__ == "__main__":
    interface.launch()