rittika03 commited on
Commit
06681e6
·
1 Parent(s): c0b791b

Login credentials table + theme-consistent maps

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -69,7 +69,7 @@ def require_login():
69
  st.markdown(
70
  "<div style='background:linear-gradient(135deg,#7C3AED,#EC4899);"
71
  "border-radius:18px;padding:26px 30px;color:#fff;margin-bottom:20px;'>"
72
- "<div style='font-size:2rem;font-weight:600;'>दृष्टि — DRISHTI</div>"
73
  "<div style='opacity:0.92;margin-top:4px;'>Digital Real-time Intelligence for "
74
  "Smart Hotspot &amp; Traffic Insights · हर सड़क पर नज़र, हर सफ़र आसान</div></div>",
75
  unsafe_allow_html=True)
@@ -85,7 +85,10 @@ def require_login():
85
  st.query_params["auth"] = "1"
86
  st.rerun()
87
  st.error("Invalid username or password.")
88
- st.info("**Demo login** `admin` / `admin123` · `officer` / `officer123`")
 
 
 
89
  st.stop()
90
 
91
  # sidebar starts open so the nav is always visible
@@ -573,7 +576,7 @@ if section == "tab_map":
573
  unsafe_allow_html=True)
574
  layer = pdk.Layer("H3HexagonLayer", view, pickable=True, filled=True, extruded=True,
575
  get_hexagon="h3", get_fill_color="fill",
576
- get_elevation="cii", elevation_scale=8, opacity=0.55)
577
  st.pydeck_chart(pdk.Deck(
578
  layers=[layer],
579
  initial_view_state=pdk.ViewState(latitude=12.97, longitude=77.59, zoom=11, pitch=45),
@@ -591,7 +594,7 @@ if section == "tab_map":
591
  "fontFamily": "Plus Jakarta Sans, sans-serif",
592
  "border": "1px solid rgba(139,92,246,0.45)",
593
  "boxShadow": "0 8px 26px rgba(0,0,0,0.4)"}},
594
- ), use_container_width=True, height=560)
595
 
596
  elif section == "tab_ops":
597
  st.subheader("🚨 Live operations — congestion alerts & enforcement")
@@ -878,7 +881,7 @@ elif section == "tab_fc":
878
  initial_view_state=pdk.ViewState(latitude=12.97, longitude=77.59, zoom=11, pitch=0),
879
  map_style=MAP_STYLE,
880
  tooltip={"html": "Risk #{risk_rank} · {pred_intensity}<br/>{location}"},
881
- ), use_container_width=True, height=520)
882
  st.dataframe(topf[["risk_rank", "location", "junction_name",
883
  "pred_intensity", "cii"]].rename(columns={
884
  "risk_rank": "Risk rank", "location": "Location", "junction_name": "Nearest junction",
@@ -925,7 +928,7 @@ elif section == "tab_patrol":
925
  map_style=MAP_STYLE,
926
  tooltip={"html": "<b>{location}</b><br/>pred {pred_intensity} · "
927
  "{units} unit(s)<br/>{shift}"}),
928
- use_container_width=True, height=420)
929
 
930
  brief = view.copy()
931
  brief["order"] = range(1, len(brief) + 1)
@@ -1038,7 +1041,7 @@ elif section == "tab_event":
1038
  initial_view_state=pdk.ViewState(latitude=vlat, longitude=vlon, zoom=13, pitch=0),
1039
  map_style=MAP_STYLE,
1040
  tooltip={"html": "<b>{location}</b><br/>CII {cii} → surge {surge_cii} (+{delta})"}),
1041
- use_container_width=True, height=440)
1042
 
1043
  show = surge[["location", "junction_name", "cii", "surge_cii", "delta",
1044
  "n_violations"]].rename(columns={
 
69
  st.markdown(
70
  "<div style='background:linear-gradient(135deg,#7C3AED,#EC4899);"
71
  "border-radius:18px;padding:26px 30px;color:#fff;margin-bottom:20px;'>"
72
+ "<div style='font-size:2rem;font-weight:800;'>दृष्टि — DRISHTI</div>"
73
  "<div style='opacity:0.92;margin-top:4px;'>Digital Real-time Intelligence for "
74
  "Smart Hotspot &amp; Traffic Insights · हर सड़क पर नज़र, हर सफ़र आसान</div></div>",
75
  unsafe_allow_html=True)
 
85
  st.query_params["auth"] = "1"
86
  st.rerun()
87
  st.error("Invalid username or password.")
88
+ st.caption("Demo credentials sign in with either account:")
89
+ st.table(pd.DataFrame(
90
+ {"USERNAME": ["admin", "officer"], "PASSWORD": ["admin123", "officer123"]}
91
+ ).set_index("USERNAME"))
92
  st.stop()
93
 
94
  # sidebar starts open so the nav is always visible
 
576
  unsafe_allow_html=True)
577
  layer = pdk.Layer("H3HexagonLayer", view, pickable=True, filled=True, extruded=True,
578
  get_hexagon="h3", get_fill_color="fill",
579
+ get_elevation="cii", elevation_scale=8, opacity=0.7)
580
  st.pydeck_chart(pdk.Deck(
581
  layers=[layer],
582
  initial_view_state=pdk.ViewState(latitude=12.97, longitude=77.59, zoom=11, pitch=45),
 
594
  "fontFamily": "Plus Jakarta Sans, sans-serif",
595
  "border": "1px solid rgba(139,92,246,0.45)",
596
  "boxShadow": "0 8px 26px rgba(0,0,0,0.4)"}},
597
+ ), use_container_width=True, height=560, key=f"impactmap_{THEME}")
598
 
599
  elif section == "tab_ops":
600
  st.subheader("🚨 Live operations — congestion alerts & enforcement")
 
881
  initial_view_state=pdk.ViewState(latitude=12.97, longitude=77.59, zoom=11, pitch=0),
882
  map_style=MAP_STYLE,
883
  tooltip={"html": "Risk #{risk_rank} · {pred_intensity}<br/>{location}"},
884
+ ), use_container_width=True, height=520, key=f"fcmap_{THEME}")
885
  st.dataframe(topf[["risk_rank", "location", "junction_name",
886
  "pred_intensity", "cii"]].rename(columns={
887
  "risk_rank": "Risk rank", "location": "Location", "junction_name": "Nearest junction",
 
928
  map_style=MAP_STYLE,
929
  tooltip={"html": "<b>{location}</b><br/>pred {pred_intensity} · "
930
  "{units} unit(s)<br/>{shift}"}),
931
+ use_container_width=True, height=420, key=f"patrolmap_{THEME}")
932
 
933
  brief = view.copy()
934
  brief["order"] = range(1, len(brief) + 1)
 
1041
  initial_view_state=pdk.ViewState(latitude=vlat, longitude=vlon, zoom=13, pitch=0),
1042
  map_style=MAP_STYLE,
1043
  tooltip={"html": "<b>{location}</b><br/>CII {cii} → surge {surge_cii} (+{delta})"}),
1044
+ use_container_width=True, height=440, key=f"eventmap_{THEME}")
1045
 
1046
  show = surge[["location", "junction_name", "cii", "surge_cii", "delta",
1047
  "n_violations"]].rename(columns={