Sanjayraju30 commited on
Commit
97fc45f
·
verified ·
1 Parent(s): e6be835

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -0
app.py CHANGED
@@ -106,7 +106,33 @@ col3.metric("Energy", int(site_df['Energy'].sum()))
106
 
107
 
108
  # Table View
 
 
 
109
  st.subheader(f"📋 Pole Data Table for {selected_site}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  with st.expander("Filter Options"):
111
  alert_filter = st.multiselect("Alert Level", options=site_df['Alert Level'].unique(), default=site_df['Alert Level'].unique())
112
  camera_filter = st.multiselect("Camera Status", options=site_df['Camera Status'].unique(), default=site_df['Camera Status'].unique())
 
106
 
107
 
108
  # Table View
109
+ # Check if the selected site exists (ensure indentation here is consistent)
110
+ if selected_site:
111
+ # Display the subheader with the selected site name
112
  st.subheader(f"📋 Pole Data Table for {selected_site}")
113
+
114
+ # Add the rest of your logic here if needed for the table
115
+ # For example, showing a data table for the selected site
116
+ st.dataframe(site_df)
117
+
118
+ # Other code related to displaying the metrics can go here too
119
+ col1, col2, col3 = st.columns(3)
120
+
121
+ col1.metric("Total Poles", len(site_df))
122
+
123
+ # Safely access 'AlertLevel' and count red alerts
124
+ if 'AlertLevel' in site_df.columns:
125
+ red_alerts = site_df[site_df['AlertLevel'] == 'Red'].shape[0]
126
+ else:
127
+ red_alerts = 0
128
+
129
+ col2.metric("Red Alerts", red_alerts)
130
+
131
+ # If you have other metrics like energy:
132
+ col3.metric("Energy", int(site_df['Energy'].sum()))
133
+ else:
134
+ st.warning("Please select a valid site.")
135
+
136
  with st.expander("Filter Options"):
137
  alert_filter = st.multiselect("Alert Level", options=site_df['Alert Level'].unique(), default=site_df['Alert Level'].unique())
138
  camera_filter = st.multiselect("Camera Status", options=site_df['Camera Status'].unique(), default=site_df['Camera Status'].unique())