Spaces:
Sleeping
Sleeping
import streamlit as st | |
import folium | |
from folium.plugins import HeatMap | |
import pandas as pd | |
import plotly.express as px | |
# Function to display the fault heatmap | |
def display_fault_heatmap(df): | |
st.subheader("π‘οΈ Fault Heatmap") | |
# Filter out red alert poles | |
red_alert_poles = df[df["Alert Level"] == "Red"] | |
# Create a folium map centered around a location (e.g., Hyderabad) | |
map_center = [17.385044, 78.486671] # Hyderabad latitude, longitude (you can adjust for other cities) | |
folium_map = folium.Map(location=map_center, zoom_start=7) | |
# Add markers for poles with red alerts | |
for _, row in red_alert_poles.iterrows(): | |
folium.CircleMarker( | |
location=[row['Latitude'], row['Longitude']], # Adjust your data accordingly | |
radius=8, | |
color='red', | |
fill=True, | |
fill_color='red', | |
fill_opacity=0.7, | |
popup=f"Pole: {row['Pole ID']}, Anomalies: {row['Anomalies']}" | |
).add_to(folium_map) | |
# Display the map | |
st.write(folium_map) | |
# Function to display the dashboard | |
def display_dashboard(df): | |
st.subheader("π System Summary") | |
col1, col2 = st.columns(2) | |
col1.metric("Total Poles", df.shape[0]) | |
col2.metric("π¨ Red Alerts", df[df['Alert Level'] == "Red"].shape[0]) | |
display_fault_heatmap(df) | |
def display_charts(df): | |
st.subheader("βοΈ Energy Generation") | |
st.plotly_chart(px.bar(df, x="Pole ID", y=["Solar Gen (kWh)", "Wind Gen (kWh)"], barmode="group")) | |
st.subheader("π Tilt vs Vibration") | |
fig = px.scatter(df, x="Tilt (Β°)", y="Vibration (g)", color="Alert Level", hover_data=["Pole ID"]) | |
st.plotly_chart(fig) | |