Spaces:
Build error
Build error
| 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) |