| import streamlit as st | |
| import sys | |
| import os | |
| # ✅ Fix path for modules (MUST be done before importing from modules) | |
| sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) | |
| # ✅ Now import from modules | |
| from modules.streamlit_ui import display_video_feed, display_alerts | |
| from modules.fault_detection import detect_faults | |
| from modules.ai_model import run_inference | |
| from modules.utils import load_image # If you're using image pre-processing | |
| # Streamlit app logic | |
| st.title("Solar Panel and Windmill Fault Monitoring System") | |
| # Sidebar controls | |
| st.sidebar.header("Simulation Controls") | |
| num_assets = st.sidebar.slider("Number of Assets", min_value=5, max_value=50, value=10) | |
| simulate_faults = st.sidebar.checkbox("Simulate Random Faults", value=True) | |
| # Display live video feed | |
| video_feed = display_video_feed() | |
| # Process video feed for fault detection | |
| faults = detect_faults(video_feed) | |
| # Display fault alerts if detected | |
| if faults: | |
| display_alerts(faults) | |