Update app.py
Browse files
app.py
CHANGED
|
@@ -16,18 +16,55 @@ from transformers import DetrImageProcessor, DetrForObjectDetection
|
|
| 16 |
from transformers import DetrImageProcessor, DetrForObjectDetection
|
| 17 |
import networkx as nx
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
st.title("ποΈ AI-Powered Civil Engineering Assistant")
|
| 21 |
|
| 22 |
-
# Sidebar Navigation
|
| 23 |
st.sidebar.title("Navigation")
|
| 24 |
section = st.sidebar.radio("Go to", [
|
| 25 |
-
"
|
| 26 |
-
"Project Management",
|
| 27 |
"On-site Safety",
|
|
|
|
| 28 |
"Video Safety Violation Detector",
|
| 29 |
"About"
|
| 30 |
-
])
|
| 31 |
|
| 32 |
# Load the DETR model and processor once
|
| 33 |
@st.cache_resource
|
|
@@ -83,9 +120,9 @@ def project_management():
|
|
| 83 |
st.dataframe(df)
|
| 84 |
|
| 85 |
st.markdown("### ποΈ Project Timeline")
|
| 86 |
-
st.write(f"-
|
| 87 |
-
st.write(f"-
|
| 88 |
-
st.write(f"-
|
| 89 |
|
| 90 |
# Gantt Chart
|
| 91 |
st.subheader("π Gantt Chart")
|
|
@@ -228,12 +265,12 @@ def about():
|
|
| 228 |
st.markdown("- Modules: Sustainable Design, Project Management, Safety Monitor, Video Violation Detection")
|
| 229 |
|
| 230 |
# Navigation
|
| 231 |
-
if section == "
|
| 232 |
-
sustainable_design()
|
| 233 |
-
elif section == "Project Management":
|
| 234 |
project_management()
|
| 235 |
elif section == "On-site Safety":
|
| 236 |
on_site_safety()
|
|
|
|
|
|
|
| 237 |
elif section == "Video Safety Violation Detector":
|
| 238 |
video_safety_detector()
|
| 239 |
elif section == "About":
|
|
|
|
| 16 |
from transformers import DetrImageProcessor, DetrForObjectDetection
|
| 17 |
import networkx as nx
|
| 18 |
|
| 19 |
+
# Set page config with light beige background
|
| 20 |
+
st.set_page_config(
|
| 21 |
+
page_title="AI Toolkit for Civil Engineers",
|
| 22 |
+
layout="wide",
|
| 23 |
+
page_icon="ποΈ"
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
# Custom CSS for light beige background and red navigation
|
| 27 |
+
st.markdown(
|
| 28 |
+
"""
|
| 29 |
+
<style>
|
| 30 |
+
.stApp {
|
| 31 |
+
background-color: #f5f5dc; /* Light beige */
|
| 32 |
+
}
|
| 33 |
+
.sidebar .sidebar-content {
|
| 34 |
+
background-color: #f5f5dc;
|
| 35 |
+
}
|
| 36 |
+
[data-testid="stSidebarNav"] {
|
| 37 |
+
background-color: #f5f5dc;
|
| 38 |
+
}
|
| 39 |
+
.stRadio div[role="radiogroup"] label {
|
| 40 |
+
background-color: #ff4d4d !important; /* Red buttons */
|
| 41 |
+
color: white !important;
|
| 42 |
+
padding: 10px;
|
| 43 |
+
margin: 5px 0;
|
| 44 |
+
border-radius: 5px;
|
| 45 |
+
}
|
| 46 |
+
.stRadio div[role="radiogroup"] label:hover {
|
| 47 |
+
background-color: #ff3333 !important;
|
| 48 |
+
}
|
| 49 |
+
.stRadio div[role="radiogroup"] label[data-baseweb="radio"]:first-child {
|
| 50 |
+
margin-top: 0;
|
| 51 |
+
}
|
| 52 |
+
</style>
|
| 53 |
+
""",
|
| 54 |
+
unsafe_allow_html=True
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
st.title("ποΈ AI-Powered Civil Engineering Assistant")
|
| 58 |
|
| 59 |
+
# Sidebar Navigation with reordered options
|
| 60 |
st.sidebar.title("Navigation")
|
| 61 |
section = st.sidebar.radio("Go to", [
|
| 62 |
+
"Project Management", # Moved to top as requested
|
|
|
|
| 63 |
"On-site Safety",
|
| 64 |
+
"Sustainable Design", # Moved to 3rd position
|
| 65 |
"Video Safety Violation Detector",
|
| 66 |
"About"
|
| 67 |
+
], index=0)
|
| 68 |
|
| 69 |
# Load the DETR model and processor once
|
| 70 |
@st.cache_resource
|
|
|
|
| 120 |
st.dataframe(df)
|
| 121 |
|
| 122 |
st.markdown("### ποΈ Project Timeline")
|
| 123 |
+
st.write(f"- *Start Date:* {df['Start Date'].min().date()}")
|
| 124 |
+
st.write(f"- *End Date:* {df['End Date'].max().date()}")
|
| 125 |
+
st.write(f"- *Total Tasks:* {len(df)}")
|
| 126 |
|
| 127 |
# Gantt Chart
|
| 128 |
st.subheader("π Gantt Chart")
|
|
|
|
| 265 |
st.markdown("- Modules: Sustainable Design, Project Management, Safety Monitor, Video Violation Detection")
|
| 266 |
|
| 267 |
# Navigation
|
| 268 |
+
if section == "Project Management": # Changed to match new order
|
|
|
|
|
|
|
| 269 |
project_management()
|
| 270 |
elif section == "On-site Safety":
|
| 271 |
on_site_safety()
|
| 272 |
+
elif section == "Sustainable Design": # Changed to match new order
|
| 273 |
+
sustainable_design()
|
| 274 |
elif section == "Video Safety Violation Detector":
|
| 275 |
video_safety_detector()
|
| 276 |
elif section == "About":
|