SHELLAPANDIANGANHUNGING commited on
Commit
38b9940
·
verified ·
1 Parent(s): 1ab9794

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -32
app.py CHANGED
@@ -1695,39 +1695,20 @@ if col_speed and col_speed in df.columns:
1695
  # --- Persentase ---
1696
  high_speed_pct = (len(high_speed_fatigue) / len(df) * 100) if len(df) > 0 else 0
1697
 
1698
- # --- Title (optional) ---
1699
- st.markdown(f"### High-Speed Fatigue Risk")
1700
-
1701
- # --- Small centered card (not full width) ---
1702
- col_left, col_center, col_right = st.columns([1, 2, 1])
1703
- with col_center:
1704
- st.markdown(
1705
- f"""
1706
- <div style="
1707
- max-width:320px;
1708
- margin:6px auto;
1709
- padding:12px 16px;
1710
- border-radius:10px;
1711
- background:#d32f2f;
1712
- color:#ffffff;
1713
- text-align:center;
1714
- box-shadow:0 6px 14px rgba(0,0,0,0.12);
1715
- ">
1716
- <div style="font-size:26px; font-weight:700; line-height:1;">
1717
- {len(high_speed_fatigue)}
1718
- </div>
1719
- <div style="font-size:14px; margin-top:4px; opacity:0.95;">
1720
- {high_speed_pct:.1f}% of total alerts
1721
- </div>
1722
- <div style="font-size:12px; margin-top:6px; opacity:0.85;">
1723
- Speed &gt; {high_speed_threshold} km/h
1724
- </div>
1725
- </div>
1726
- """,
1727
- unsafe_allow_html=True
1728
- )
1729
 
1730
- # --- Risk message below the card ---
1731
  if high_speed_pct > 20:
1732
  st.warning(
1733
  f"High risk: {high_speed_pct:.1f}% of fatigue alerts occur at high speeds. "
 
1695
  # --- Persentase ---
1696
  high_speed_pct = (len(high_speed_fatigue) / len(df) * 100) if len(df) > 0 else 0
1697
 
1698
+ # --- Teks judul + hasil warna merah ---
1699
+ st.markdown(
1700
+ f"""
1701
+ <p style="color:#d32f2f; font-size:20px; font-weight:700; margin-bottom:4px;">
1702
+ High-Speed Fatigue Events: {len(high_speed_fatigue)}
1703
+ </p>
1704
+ <p style="color:#d32f2f; font-size:15px; font-weight:500; margin-top:-6px;">
1705
+ {high_speed_pct:.1f}% of total alerts (Speed > {high_speed_threshold} km/h)
1706
+ </p>
1707
+ """,
1708
+ unsafe_allow_html=True
1709
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1710
 
1711
+ # --- pesan risiko ---
1712
  if high_speed_pct > 20:
1713
  st.warning(
1714
  f"High risk: {high_speed_pct:.1f}% of fatigue alerts occur at high speeds. "