Spaces:
Sleeping
Sleeping
Render hosted insights without unstable nested action
Browse filesOpening AI Insights now immediately renders the computed analyst brief on Hugging Face, eliminating the session-dropping nested button.
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
|
|
|
|
|
|
|
|
|
|
| 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
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 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(
|
|
|
|
|
|
|
| 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 |
)
|