Add post-diarization speaker review workflow
This commit is contained in:
+25
-16
@@ -554,7 +554,15 @@ def _render_result() -> None:
|
||||
st.caption("Intermediate artifacts and run metadata were preserved here.")
|
||||
return
|
||||
|
||||
st.success("Processing completed. Review the generated protocol before use.")
|
||||
awaiting_review = getattr(outcome, "awaiting_speaker_review", False)
|
||||
if awaiting_review:
|
||||
count = getattr(outcome, "detected_speaker_count", None)
|
||||
detected = f"{count} speakers detected" if count is not None else "speakers detected"
|
||||
st.info(
|
||||
f"Diarization complete — {detected}. Assign speakers if desired, then generate the protocol."
|
||||
)
|
||||
else:
|
||||
st.success("Processing completed. Review the generated protocol before use.")
|
||||
st.caption(f"Run artifacts: {outcome.run_dir}")
|
||||
if outcome.speaker_attribution_available is False:
|
||||
st.warning(
|
||||
@@ -563,17 +571,18 @@ def _render_result() -> None:
|
||||
)
|
||||
if message := st.session_state.pop("speaker_mapping_message", None):
|
||||
st.success(message)
|
||||
with st.expander("Original generated protocol", expanded=False):
|
||||
st.markdown(outcome.original_protocol or "")
|
||||
edited = st.text_area(
|
||||
"Editable protocol",
|
||||
key="edited_protocol",
|
||||
height=500,
|
||||
help="The original protocol.md remains unchanged.",
|
||||
)
|
||||
if st.button("Save edited protocol", type="primary"):
|
||||
path = MeetingProcessingService.save_edited_protocol(outcome.run_dir, edited)
|
||||
st.success(f"Saved edited protocol to {path}")
|
||||
if not awaiting_review:
|
||||
with st.expander("Original generated protocol", expanded=False):
|
||||
st.markdown(outcome.original_protocol or "")
|
||||
edited = st.text_area(
|
||||
"Editable protocol",
|
||||
key="edited_protocol",
|
||||
height=500,
|
||||
help="The original protocol.md remains unchanged.",
|
||||
)
|
||||
if st.button("Save edited protocol", type="primary"):
|
||||
path = MeetingProcessingService.save_edited_protocol(outcome.run_dir, edited)
|
||||
st.success(f"Saved edited protocol to {path}")
|
||||
|
||||
try:
|
||||
service = MeetingProcessingService(AppSettings.from_environment(), MeetingLabGateway())
|
||||
@@ -590,7 +599,7 @@ def _render_result() -> None:
|
||||
if duplicate_assignments:
|
||||
st.error("Each participant can be assigned to only one detected speaker.")
|
||||
if st.button(
|
||||
"Regenerate protocol with confirmed speakers",
|
||||
"Generate protocol" if awaiting_review else "Regenerate protocol with confirmed speakers",
|
||||
disabled=duplicate_assignments,
|
||||
type="primary",
|
||||
):
|
||||
@@ -610,7 +619,7 @@ def _render_result() -> None:
|
||||
performance_profile=selected_profile,
|
||||
),
|
||||
states,
|
||||
"Starting protocol regeneration",
|
||||
"Starting protocol generation" if awaiting_review else "Starting protocol regeneration",
|
||||
)
|
||||
except (OSError, RuntimeError, ValueError) as exc:
|
||||
_remember_regeneration_timing(
|
||||
@@ -618,13 +627,13 @@ def _render_result() -> None:
|
||||
"Protocol regeneration failed",
|
||||
service.timer.snapshot(),
|
||||
)
|
||||
st.error(f"Protocol regeneration failed: {exc}")
|
||||
st.error(f"Protocol generation failed: {exc}")
|
||||
else:
|
||||
_remember_regeneration_timing(states, message, timing)
|
||||
st.session_state.outcome = regenerated
|
||||
_queue_edited_protocol(regenerated.original_protocol or "")
|
||||
st.session_state.speaker_mapping_message = (
|
||||
"Speaker mappings saved and protocol regenerated."
|
||||
"Speaker mappings saved and protocol generated."
|
||||
)
|
||||
st.rerun()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user