Spaces:
Build error
Build error
File size: 1,234 Bytes
fa12279 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import streamlit as st
import seaborn as sns
import matplotlib.pyplot as plt
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['AlertLevel']=="Red"].shape[0])
col3.metric("⚡ Power Issues", df[df['PowerSufficient']=="No"].shape[0])
def display_charts(df):
st.subheader("⚙️ Energy Generation Trends")
st.bar_chart(df.set_index("PoleID")[["SolarGen(kWh)", "WindGen(kWh)"]])
st.subheader("📉 Tilt vs Vibration")
st.scatter_chart(df.rename(columns={"Tilt(°)": "Tilt", "Vibration(g)": "Vibration"}).set_index("PoleID")[["Tilt", "Vibration"]])
def display_heatmap(df):
st.subheader("🔥 Correlation Heatmap")
# Select numerical columns for correlation
numerical_cols = ["SolarGen(kWh)", "WindGen(kWh)", "Tilt(°)", "Vibration(g)"]
corr_matrix = df[numerical_cols].corr()
# Create heatmap using seaborn
fig, ax = plt.subplots(figsize=(8, 6))
sns.heatmap(corr_matrix, annot=True, cmap="coolwarm", vmin=-1, vmax=1, center=0, ax=ax)
plt.title("Correlation Heatmap of Pole Metrics")
# Display in Streamlit
st.pyplot(fig) |