INNER CODE UNIT · Python

on_state_update

QuentinFuxa/WhisperLiveKit · whisperlivekit/cli.py:987

        def on_state_update(state):
            nonlocal n_lines_printed
            speech = state.speech_lines
            buf = state.buffer_transcription.strip()

            # Clear the buffer line
            out.write("\r\033[K")

            # Print new committed lines
            while n_lines_printed < len(speech):
                text = speech[n_lines_printed].get("text", "")
                out.write(f"  {text}\n")
                if pipe_stdout:
                    sys.stdout.write(f"{text}\n")
                    sys.stdout.flush()
                n_lines_printed += 1

            # Show buffer (ephemeral, overwritten next update)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…