detect / app.py
Sanjayraju30's picture
Update app.py
b3a117b verified
raw
history blame
1.29 kB
import gradio as gr
# ---- Overheat Detection Logic ----
def detect_overheat(temp, humidity, solar_output):
"""
Detects overheat fault in a smart pole.
Uses simple rule: if temperature > 50°C, flag as overheat.
Future scope: Add ML model here (e.g., IsolationForest or AutoEncoder).
"""
if temp > 50:
return "🔥 Overheat Detected"
else:
return "✅ Normal"
# ---- Gradio Interface ----
interface = gr.Interface(
fn=detect_overheat,
inputs=[
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 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()