Solar_Panel / app.py
Tigernawin's picture
Update app.py
379778d verified
import streamlit as st
from PIL import Image
from modules.thermal_fault_detection import detect_faults
st.set_page_config(page_title="Solar Panel Thermal Fault Detector", layout="centered")
st.title("πŸ” Solar Panel Thermal Fault Detection Dashboard")
st.markdown("""
This AI-powered app analyzes thermal images from drones to detect:
- πŸ”₯ Overheating
- 🌫️ Dust Accumulation
- πŸ”§ Physical Breakage
""")
uploaded_image = st.file_uploader("Upload a thermal image of a solar panel", type=["jpg", "png", "jpeg", "webp"])
if uploaded_image:
image = Image.open(uploaded_image).convert("RGB")
st.image(image, caption="Uploaded Thermal Image", use_column_width=True)
with st.spinner("Analyzing for thermal faults..."):
results, annotated_image = detect_faults(image)
if results:
st.error("❗ Faults Detected:")
for fault in results:
st.write(f"- πŸ”΄ **Fault Type:** {fault[0]} | **Confidence:** {fault[1]:.2f}")
st.image(annotated_image, caption="Detected Faults", use_column_width=True)
else:
st.success("βœ… No faults detected.")