Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,9 +10,42 @@ SITES = {
|
|
| 10 |
"Hyderabad": [17.385044, 78.486671],
|
| 11 |
"Gadwal": [16.2351, 77.8052],
|
| 12 |
"Kurnool": [15.8281, 78.0373],
|
| 13 |
-
"Ballari": [15.1394, 76.9214]
|
| 14 |
}
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
# ---- Helper Functions ----
|
| 17 |
def generate_location(base_lat, base_lon):
|
| 18 |
return [
|
|
@@ -77,38 +110,7 @@ def simulate_pole(pole_id, site_name):
|
|
| 77 |
'Last Checked': timestamp.strftime('%Y-%m-%d %H:%M:%S')
|
| 78 |
}
|
| 79 |
|
| 80 |
-
# ---- Custom CSS for Advanced UI ----
|
| 81 |
-
st.markdown("""
|
| 82 |
-
<style>
|
| 83 |
-
.stApp {
|
| 84 |
-
background-color: #f5f7fa;
|
| 85 |
-
}
|
| 86 |
-
.metric-card {
|
| 87 |
-
background-color: white;
|
| 88 |
-
padding: 15px;
|
| 89 |
-
border-radius: 10px;
|
| 90 |
-
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
| 91 |
-
text-align: center;
|
| 92 |
-
}
|
| 93 |
-
.red-alert {
|
| 94 |
-
background-color: #ffe6e6;
|
| 95 |
-
color: #d32f2f;
|
| 96 |
-
padding: 10px;
|
| 97 |
-
border-radius: 5px;
|
| 98 |
-
font-weight: bold;
|
| 99 |
-
}
|
| 100 |
-
.sidebar .sidebar-content {
|
| 101 |
-
background-color: #ffffff;
|
| 102 |
-
border-right: 1px solid #e0e0e0;
|
| 103 |
-
}
|
| 104 |
-
h1, h2, h3 {
|
| 105 |
-
color: #1a237e;
|
| 106 |
-
}
|
| 107 |
-
</style>
|
| 108 |
-
""", unsafe_allow_html=True)
|
| 109 |
-
|
| 110 |
# ---- Streamlit UI ----
|
| 111 |
-
st.set_page_config(page_title="Smart Pole Monitoring", layout="wide")
|
| 112 |
st.title("🌍 Smart Renewable Pole Monitoring - Multi-Site")
|
| 113 |
|
| 114 |
# Sidebar with enhanced controls
|
|
|
|
| 10 |
"Hyderabad": [17.385044, 78.486671],
|
| 11 |
"Gadwal": [16.2351, 77.8052],
|
| 12 |
"Kurnool": [15.8281, 78.0373],
|
| 13 |
+
"Ballari": [15.1394, 76.9214]
|
| 14 |
}
|
| 15 |
|
| 16 |
+
# ---- Set Page Config (Must be first Streamlit command) ----
|
| 17 |
+
st.set_page_config(page_title="Smart Pole Monitoring", layout="wide")
|
| 18 |
+
|
| 19 |
+
# ---- Custom CSS for Advanced UI ----
|
| 20 |
+
st.markdown("""
|
| 21 |
+
<style>
|
| 22 |
+
.stApp {
|
| 23 |
+
background-color: #f5f7fa;
|
| 24 |
+
}
|
| 25 |
+
.metric-card {
|
| 26 |
+
background-color: white;
|
| 27 |
+
padding: 15px;
|
| 28 |
+
border-radius: 10px;
|
| 29 |
+
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
|
| 30 |
+
text-align: center;
|
| 31 |
+
}
|
| 32 |
+
.red-alert {
|
| 33 |
+
background-color: #ffe6e6;
|
| 34 |
+
color: #d32f2f;
|
| 35 |
+
padding: 10px;
|
| 36 |
+
border-radius: 5px;
|
| 37 |
+
font-weight: bold;
|
| 38 |
+
}
|
| 39 |
+
.sidebar .sidebar-content {
|
| 40 |
+
background-color: #ffffff;
|
| 41 |
+
border-right: 1px solid #e0e0e0;
|
| 42 |
+
}
|
| 43 |
+
h1, h2, h3 {
|
| 44 |
+
color: #1a237e;
|
| 45 |
+
}
|
| 46 |
+
</style>
|
| 47 |
+
""", unsafe_allow_html=True)
|
| 48 |
+
|
| 49 |
# ---- Helper Functions ----
|
| 50 |
def generate_location(base_lat, base_lon):
|
| 51 |
return [
|
|
|
|
| 110 |
'Last Checked': timestamp.strftime('%Y-%m-%d %H:%M:%S')
|
| 111 |
}
|
| 112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
# ---- Streamlit UI ----
|
|
|
|
| 114 |
st.title("🌍 Smart Renewable Pole Monitoring - Multi-Site")
|
| 115 |
|
| 116 |
# Sidebar with enhanced controls
|