| import streamlit as st |
| import seaborn as sns |
| import matplotlib.pyplot as plt |
| import numpy as np |
| import time |
|
|
| |
| def display_dashboard(df): |
| st.subheader("π System Summary") |
|
|
| col1, col2, col3 = st.columns(3) |
|
|
| col1.metric("Total Poles", df.shape[0]) |
| col2.metric("π¨ Red Alerts", df[df['Alert Level'] == "Red"].shape[0]) |
| col3.metric("β‘ Power Issues", df[df['Power Sufficient'] == "No"].shape[0]) |
|
|
| |
| st.subheader("π Pole Signal Heatmap with Fault Zones") |
| |
| |
| data = np.random.rand(10, 10) |
| fault_x, fault_y = np.random.randint(0, 10), np.random.randint(0, 10) |
| |
| |
| fig, ax = plt.subplots(figsize=(8, 6)) |
| sns.heatmap(data, annot=True, cmap="coolwarm", ax=ax) |
| |
| |
| ax.plot(fault_y, fault_x, 'ro', markersize=10) |
| |
| st.pyplot(fig) |
|
|
| |
| def display_fault_alert(fault_x, fault_y): |
| st.error(f"Fault detected at Zone ({fault_x}, {fault_y}). Red alert triggered!") |
| |
| |
| for _ in range(5): |
| fig, ax = plt.subplots(figsize=(8, 6)) |
| sns.heatmap(np.random.rand(10, 10), annot=True, cmap="coolwarm", ax=ax) |
| |
| |
| ax.plot(fault_y, fault_x, 'ro', markersize=10) |
| |
| |
| st.pyplot(fig) |
| time.sleep(0.5) |
| ax.clear() |
|
|