Tigernawin commited on
Commit
cd4bf3c
Β·
verified Β·
1 Parent(s): f2ce2fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -1,7 +1,6 @@
1
- # app.py
2
  import streamlit as st
3
  from PIL import Image
4
- from modules.thermal_fault_detection import detect_faults
5
 
6
  st.set_page_config(page_title="Solar Panel Thermal Fault Detector", layout="centered")
7
  st.title("πŸ” Solar Panel Thermal Fault Detection Dashboard")
@@ -16,14 +15,17 @@ This AI-powered app analyzes thermal images from drones to detect:
16
  uploaded_image = st.file_uploader("Upload a thermal image of a solar panel", type=["jpg", "png", "jpeg", "webp"])
17
 
18
  if uploaded_image:
19
- image = Image.open(uploaded_image)
20
  st.image(image, caption="Uploaded Thermal Image", use_column_width=True)
21
 
22
  with st.spinner("Analyzing for thermal faults..."):
23
- results = detect_faults(image)
 
24
  if results:
25
- st.error("\n### ❗ Faults Detected:")
26
  for fault in results:
27
  st.write(f"- πŸ”΄ **Fault Type:** {fault[0]} | **Confidence:** {fault[1]:.2f}")
 
28
  else:
29
  st.success("βœ… No faults detected.")
 
 
 
1
  import streamlit as st
2
  from PIL import Image
3
+ from modules.thermal_fault_detection import detect_faults, draw_fault_boxes
4
 
5
  st.set_page_config(page_title="Solar Panel Thermal Fault Detector", layout="centered")
6
  st.title("πŸ” Solar Panel Thermal Fault Detection Dashboard")
 
15
  uploaded_image = st.file_uploader("Upload a thermal image of a solar panel", type=["jpg", "png", "jpeg", "webp"])
16
 
17
  if uploaded_image:
18
+ image = Image.open(uploaded_image).convert("RGB")
19
  st.image(image, caption="Uploaded Thermal Image", use_column_width=True)
20
 
21
  with st.spinner("Analyzing for thermal faults..."):
22
+ results, annotated_image = detect_faults(image)
23
+
24
  if results:
25
+ st.error("❗ Faults Detected:")
26
  for fault in results:
27
  st.write(f"- πŸ”΄ **Fault Type:** {fault[0]} | **Confidence:** {fault[1]:.2f}")
28
+ st.image(annotated_image, caption="Detected Faults", use_column_width=True)
29
  else:
30
  st.success("βœ… No faults detected.")
31
+