detect / app.py
Sanjayraju30's picture
Update app.py
53a1b66 verified
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()