diff options
| author | yum <yum.food.vr@gmail.com> | 2023-06-30 19:44:27 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2023-06-30 19:46:17 -0700 |
| commit | 4f3131b4a36d8e1557edb31d3754a431717dab7b (patch) | |
| tree | ea3151841f8d2d2abc38c71e87ccdffaac2be2dc /Scripts/transcribe.py | |
| parent | 9ab500036bdfa87215e9a05fc167c4d9dea8e437 (diff) | |
Add visual commit indicator to OBS browser source
Circle goes red when speaking, grey when done. Ideally it would be in
the top right portion of the browser source, but this is a good start.
Also, hard-cap transcripts to 4096 chars. This prevents the STT from
lagging during long sessions.
Diffstat (limited to 'Scripts/transcribe.py')
| -rw-r--r-- | Scripts/transcribe.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Scripts/transcribe.py b/Scripts/transcribe.py index c249e43..039811c 100644 --- a/Scripts/transcribe.py +++ b/Scripts/transcribe.py @@ -364,6 +364,18 @@ def transcribeAudio(audio_state, audio_state.text += text audio_state.preview_text = audio_state.text + preview_text + if len(preview_text) == 0: + print("Finalized: 1") + else: + print("Finalized: 0") + + # Hard cap transcript at 4096 chars. Letting it grow longer than this + # eventually causes lag. This happens routinely when streaming. Capping + # like this does not affect the visible portion of the transcript in + # OBS, but it might affect the visible portion in-game. (Don't make + # your friends read more than 4k characters on a fucking chatbox.) + audio_state.text = audio_state.text[-4096:] + now = time.time() if audio_state.enable_debug_mode: print("Raw transcription ({} seconds): {}".format( @@ -739,8 +751,6 @@ def transcribeLoop(mic: str, print(f"Translation ready to go") - print("Safe to start talking") - abspath = os.path.abspath(__file__) dname = os.path.dirname(abspath) model_root = os.path.join(dname, "Models", model) |
