Sanjayraju30 commited on
Commit
53a1b66
·
verified ·
1 Parent(s): b3a117b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,21 +1,23 @@
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)"), # Temperature input
20
  gr.Number(label="Humidity (%)"), # Humidity input
21
  gr.Number(label="Solar Output (Watts)") # Solar Output input
@@ -25,7 +27,7 @@ interface = gr.Interface(
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
  ), # Description of how the app works
30
  theme="default" # App theme
31
  )
 
1
  import gradio as gr
2
 
3
  # ---- Overheat Detection Logic ----
4
+ def detect_overheat(area, 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
+ Displays the area name when the fault is detected.
9
  Future scope: Add ML model here (e.g., IsolationForest or AutoEncoder).
10
  """
11
  if temp > 50:
12
+ return f"Area: {area} - 🔥 Overheat Detected"
13
  else:
14
+ return f"Area: {area} - ✅ Normal"
15
 
16
  # ---- Gradio Interface ----
17
  interface = gr.Interface(
18
  fn=detect_overheat,
19
  inputs=[
20
+ gr.Textbox(label="Area Name", placeholder="Enter the area name (e.g., Ramanthapur, Hyderabad)"), # Area input
21
  gr.Number(label="Temperature (°C)"), # Temperature input
22
  gr.Number(label="Humidity (%)"), # Humidity input
23
  gr.Number(label="Solar Output (Watts)") # Solar Output input
 
27
  description=(
28
  "This tool detects overheating faults in Vedavathi Intelligent Energy Poles "
29
  "(VIEP) based on sensor readings from each pole. "
30
+ "Enter the area name, temperature, humidity, and solar power output to check for overheating faults."
31
  ), # Description of how the app works
32
  theme="default" # App theme
33
  )