Label interim frames, commit finals in live transcription examples#22
Merged
Merged
Conversation
Drop the '\r{transcript}' in-place rewrite trick. It worked for short
single-line transcripts but accumulated wrapped rows on screen when the
cumulative transcript exceeded terminal width, producing a 'stuck' /
repeated-text effect mid-session.
Plain newline-per-event has no overwrite logic to break — the terminal
scrolls naturally. Also drops the leading '\n' from error/closed prints
since the transcript is no longer in-place.
2f7381b to
c60cd7a
Compare
Supersede the plain newline-per-event print with an is_final-aware display: interim frames print as "[Interim] ..." lines and the finalized utterance commits on its own line, so a new utterance after a pause no longer overwrites the previous one. Document is_final / commit-on-final on the ResultsEvent docstring. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The realtime backend ships a cumulative transcript per utterance and resets it on each new utterance (
is_finalflipstrueon the finalizing frame). Printing everyResultsplainly floods a line per interim, and the older\roverwrite loses prior utterances after a pause.This makes the examples
is_final-aware:[Interim] {text}lines;\r\033[K{text}\n), so a new utterance after a pause no longer overwrites the previous one.Also documents
is_final/ commit-on-final on theResultsEventdocstring.Test plan
python examples/live_transcription_microphone.py— speak, pause, speak again: each finished utterance lands on its own line; interims show as[Interim] …python examples/live_transcription_file.py sample.wav— same, file-paced🤖 Generated with Claude Code