dineshb commited on
Commit
0d6d12c
·
verified ·
1 Parent(s): 6c6585f

Render hosted insights without unstable nested action

Browse files

Opening AI Insights now immediately renders the computed analyst brief on Hugging Face, eliminating the session-dropping nested button.

Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -339,19 +339,19 @@ with ai_tab:
339
  st.caption(
340
  "AI interpretation based on dataset metadata and limited redacted samples. Verify against source documentation."
341
  )
342
- if not api_key:
 
 
 
343
  st.warning(
344
  "Enter a Gemini API key in the sidebar. Deterministic profiling remains fully available without AI."
345
  )
346
  ai_future = st.session_state.ai_future
347
- if st.button(
348
- "Generate AI analyst brief",
349
- disabled=not bool(api_key) or ai_future is not None,
350
- ):
351
- if hosted_evidence_mode:
352
- st.session_state.ai_summary = evidence_dataset_summary(frame, profile)
353
- st.success("Evidence-grounded analyst brief ready")
354
- else:
355
  st.session_state.ai_future = ai_executor().submit(
356
  gemini_dataset_summary,
357
  frame.copy(deep=True),
@@ -382,7 +382,9 @@ with ai_tab:
382
  st.rerun()
383
  if st.session_state.ai_summary:
384
  st.markdown(st.session_state.ai_summary)
385
- with st.expander("What may be sent to Gemini"):
 
 
386
  st.write(
387
  "Column metadata, aggregate statistics, target candidates, quality score, and up to three redacted example rows."
388
  )
 
339
  st.caption(
340
  "AI interpretation based on dataset metadata and limited redacted samples. Verify against source documentation."
341
  )
342
+ if hosted_evidence_mode:
343
+ st.session_state.ai_summary = evidence_dataset_summary(frame, profile)
344
+ st.success("Evidence-grounded analyst brief ready")
345
+ elif not api_key:
346
  st.warning(
347
  "Enter a Gemini API key in the sidebar. Deterministic profiling remains fully available without AI."
348
  )
349
  ai_future = st.session_state.ai_future
350
+ if not hosted_evidence_mode:
351
+ if st.button(
352
+ "Generate AI analyst brief",
353
+ disabled=not bool(api_key) or ai_future is not None,
354
+ ):
 
 
 
355
  st.session_state.ai_future = ai_executor().submit(
356
  gemini_dataset_summary,
357
  frame.copy(deep=True),
 
382
  st.rerun()
383
  if st.session_state.ai_summary:
384
  st.markdown(st.session_state.ai_summary)
385
+ with st.expander(
386
+ "Evidence used for this brief" if hosted_evidence_mode else "What may be sent to Gemini"
387
+ ):
388
  st.write(
389
  "Column metadata, aggregate statistics, target candidates, quality score, and up to three redacted example rows."
390
  )