SHELLAPANDIANGANHUNGING commited on
Commit
2cf4a95
·
verified ·
1 Parent(s): 40154f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -1615,11 +1615,11 @@ def predict_categories(df):
1615
  df_res = pd.DataFrame(results)
1616
 
1617
  # ✅ FILTER: Coverage = 100% AND Trend Slope > 0
1618
- if not df_res.empty:
1619
- df_res = df_res[
1620
- (df_res['Coverage (%)'] == 100.0) &
1621
- (df_res['Trend Slope'] > 0)
1622
- ].copy()
1623
 
1624
  df_res['Status'] = df_res['Trend Slope'].apply(
1625
  lambda s: "<span class='trend-rising'>High-Risk Rising</span>" if s > 0.2 else
@@ -1744,7 +1744,7 @@ if not df_division.empty:
1744
  st.markdown("</div>", unsafe_allow_html=True)
1745
 
1746
  # 🎯 PANEL 4: Categories (FILTERED: Non-Positive + Coverage=100% & Rising)
1747
- st.markdown("<div class='predictive-panel'>", unsafe_allow_html=True)
1748
  st.markdown(
1749
  "<div class='predictive-header'>"
1750
  "4. Which Issue Categories Are Likely to Appear in the Next 3 Months (Non-Positive Only)"
@@ -1755,16 +1755,16 @@ st.markdown(
1755
  unsafe_allow_html=True
1756
  )
1757
 
1758
- if not df_category.empty:
1759
- cols = ['Category', 'Avg/Month', 'Coverage (%)', 'Trend Slope', 'Status', 'Trend']
1760
 
1761
- # 🔵 Rename ONLY for display
1762
- df_display = df_category[cols].rename(columns={
1763
- "Status": "Status Issue for Next Month"
1764
- })
1765
 
1766
- html = df_display.to_html(escape=False, index=False, table_id="tbl-categories")
1767
- st.markdown(f"<div class='predictive-table-wrapper'>{html}</div>", unsafe_allow_html=True)
1768
 
1769
  # st.markdown(
1770
  # "<div class='predictive-note'>"
@@ -1787,11 +1787,11 @@ if not df_category.empty:
1787
  # unsafe_allow_html=True
1788
  # )
1789
 
1790
- st.markdown("</div>", unsafe_allow_html=True)
1791
 
1792
 
1793
  # =================== WHITEBOARD STYLE CHART FOR PANEL 4 ===================
1794
- st.markdown("<h4 style='text-align: center; color: #2c3e50;'>Whiteboard Insight: Trend vs Frequency</h4>", unsafe_allow_html=True)
1795
 
1796
  # Buat chart scatter dengan gaya whiteboard
1797
  if not df_category.empty:
 
1615
  df_res = pd.DataFrame(results)
1616
 
1617
  # ✅ FILTER: Coverage = 100% AND Trend Slope > 0
1618
+ if not df_res.empty:df_res
1619
+ # df_res = df_res[
1620
+ # (df_res['Coverage (%)'] == 100.0) &
1621
+ # (df_res['Trend Slope'] > 0)
1622
+ # ].copy()
1623
 
1624
  df_res['Status'] = df_res['Trend Slope'].apply(
1625
  lambda s: "<span class='trend-rising'>High-Risk Rising</span>" if s > 0.2 else
 
1744
  st.markdown("</div>", unsafe_allow_html=True)
1745
 
1746
  # 🎯 PANEL 4: Categories (FILTERED: Non-Positive + Coverage=100% & Rising)
1747
+ # st.markdown("<div class='predictive-panel'>", unsafe_allow_html=True)
1748
  st.markdown(
1749
  "<div class='predictive-header'>"
1750
  "4. Which Issue Categories Are Likely to Appear in the Next 3 Months (Non-Positive Only)"
 
1755
  unsafe_allow_html=True
1756
  )
1757
 
1758
+ # if not df_category.empty:
1759
+ # cols = ['Category', 'Avg/Month', 'Coverage (%)', 'Trend Slope', 'Status', 'Trend']
1760
 
1761
+ # # 🔵 Rename ONLY for display
1762
+ # df_display = df_category[cols].rename(columns={
1763
+ # "Status": "Status Issue for Next Month"
1764
+ # })
1765
 
1766
+ # html = df_display.to_html(escape=False, index=False, table_id="tbl-categories")
1767
+ # st.markdown(f"<div class='predictive-table-wrapper'>{html}</div>", unsafe_allow_html=True)
1768
 
1769
  # st.markdown(
1770
  # "<div class='predictive-note'>"
 
1787
  # unsafe_allow_html=True
1788
  # )
1789
 
1790
+ # st.markdown("</div>", unsafe_allow_html=True)
1791
 
1792
 
1793
  # =================== WHITEBOARD STYLE CHART FOR PANEL 4 ===================
1794
+ # st.markdown("<h4 style='text-align: center; color: #2c3e50;'>Whiteboard Insight: Trend vs Frequency</h4>", unsafe_allow_html=True)
1795
 
1796
  # Buat chart scatter dengan gaya whiteboard
1797
  if not df_category.empty: