Skip to content

feat: show the transcript while speakers are still being identified (#134) - #137

Draft
raphaelm22 wants to merge 2 commits into
ObscureAintSecure:masterfrom
raphaelm22:feat/transcript-before-speakers
Draft

raphaelm22 wants to merge 2 commits into
ObscureAintSecure:masterfrom
raphaelm22:feat/transcript-before-speakers

Conversation

@raphaelm22

Copy link
Copy Markdown

Closes #134.

Summary

With pyannote diarization on, the transcript stayed hidden until diarization finished. That can take about as long as the recording on a CPU: 34 minutes for a 31-minute meeting whose transcription took 5.

The transcript is now displayed and saved as soon as transcription finishes. Speaker labels fill in when diarization completes.

  • _start_diarization calls the new _show_transcript_preview once the worker has started:
    • the displayed session gets display_transcript plus _save_transcript, and the progress bar stays up;
    • any other session gets _write_transcript_for_session.
  • Edits are kept. The preview shares its segment objects with DiarizationWorker, which only ever sets .speaker. Text edited while diarization runs is already in the final result.
  • Reopened previews: if the user switches to another recording and back, the preview is reloaded from disk and is no longer the worker's object. _finish_diarized_transcript copies its edits onto the final result before displaying it, on both the finished and error paths. Segments are matched by position and timestamps; anything else is treated as a different transcript and left alone.
  • Progress bar on return: reopening a recording whose speakers are still being identified shows the progress bar again.
  • Unchanged: summaries, chat context, the tray notification and the job queue still wait for _display_final_transcript. Auto-summary needs the speakers, and the queue is still busy.
  • Crash safety, as a side effect: the transcript is on disk before diarization starts, so closing the app mid-diarization no longer loses it.

Tests

tests/test_transcript_preview.py, 17 new tests, using the stub-self pattern from test_system_monitor_start.py. DiarizationWorker is patched with autospec. The tests cover:

  • the preview follows the worker start;
  • no preview when there is no audio;
  • display and save for the current session, and its own directory for another;
  • the preview leaves the progress bar, auto-summary and the queue alone;
  • _carry_over_edits: the edit reaches the final result, and same object, other timestamps, other length and nothing shown are all ignored;
  • both diarization outcomes go through _finish_diarized_transcript;
  • the progress bar shows only for the recording being diarized, and only while it runs.

Without the change, 14 of the 17 fail. Full suite: 425 passed.

🤖 Generated with Claude Code

…bscureAintSecure#134)

pyannote takes about as long as the recording on a CPU, and the transcript waited for it. Display and save the transcript as soon as transcription finishes; speaker labels fill in when diarization completes.

The preview shares segment objects with DiarizationWorker, which only sets .speaker, so edits made meanwhile reach the final transcript. A preview reopened from disk gets its edits copied over before the final display. Summaries, chat context and the job queue still wait for the final result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show the transcript while speakers are still being identified

1 participant