MohitRajput45 commited on
Commit
9ab0852
Β·
verified Β·
1 Parent(s): 60dd430

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -151,8 +151,12 @@ def _render_shap_inline(html_path: str):
151
  if os.path.exists(html_path):
152
  with open(html_path, "r", encoding="utf-8") as f:
153
  shap_html = f.read()
 
 
 
 
154
  with st.expander("πŸ”¬ View XAI Word-Level Explanation (SHAP)", expanded=False):
155
- components.html(shap_html, height=300, scrolling=True)
156
 
157
  # ─────────────────────────────────────────────────────────────
158
  # PAGE 1: CHAT COMPANION
@@ -293,7 +297,11 @@ def render_dashboard():
293
  if os.path.exists(SHAP_HTML_PATH):
294
  with open(SHAP_HTML_PATH, "r", encoding="utf-8") as f:
295
  shap_html = f.read()
296
- components.html(shap_html, height=500, scrolling=True)
 
 
 
 
297
  st.caption(f"Report path: `{SHAP_HTML_PATH}`")
298
  else:
299
  st.info("Send a message in the Chat Companion tab to generate the first XAI report.")
 
151
  if os.path.exists(html_path):
152
  with open(html_path, "r", encoding="utf-8") as f:
153
  shap_html = f.read()
154
+
155
+ # --- THE FIX: Force a white background for Dark Mode ---
156
+ safe_html = f'<div style="background-color: white; padding: 20px; border-radius: 10px;">{shap_html}</div>'
157
+
158
  with st.expander("πŸ”¬ View XAI Word-Level Explanation (SHAP)", expanded=False):
159
+ components.html(safe_html, height=300, scrolling=True)
160
 
161
  # ─────────────────────────────────────────────────────────────
162
  # PAGE 1: CHAT COMPANION
 
297
  if os.path.exists(SHAP_HTML_PATH):
298
  with open(SHAP_HTML_PATH, "r", encoding="utf-8") as f:
299
  shap_html = f.read()
300
+
301
+ # --- THE FIX: Force a white background for Dark Mode ---
302
+ safe_html = f'<div style="background-color: white; padding: 20px; border-radius: 10px;">{shap_html}</div>'
303
+
304
+ components.html(safe_html, height=500, scrolling=True)
305
  st.caption(f"Report path: `{SHAP_HTML_PATH}`")
306
  else:
307
  st.info("Send a message in the Chat Companion tab to generate the first XAI report.")