Skip to content

Commit

Permalink
Merge branch 'guy/live_captions' into guy/evan/live_captions
Browse files Browse the repository at this point in the history
  • Loading branch information
evmaki committed Oct 25, 2024
2 parents 6c1e62f + 07b510b commit 6a277b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 7 additions & 7 deletions moonshine/demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,20 @@ for a value of 0.2 seconds.
```console
(env_moonshine_faster_whisper) parallels@ubuntu-linux-2404:~$ python3 moonshine/moonshine/demo/live_captions.py
Error in cpuinfo: prctl(PR_SVE_GET_VL) failed
Loading Faster-Whisper int8 base.en model ...
Loading Faster-Whisper float32 base.en model ...
Press Ctrl+C to quit live captions.

sper int8 base model being used to generate captions while someone is speaking. ^C
r float32 base model being used to generate captions while someone is speaking. ^C

model_size : base.en
MIN_REFRESH_SECS : 1.0s
MIN_REFRESH_SECS : 1.2s

number inferences : 7
mean inference time : 0.86s
model realtime factor : 5.77x
number inferences : 6
mean inference time : 1.02s
model realtime factor : 4.82x

Cached captions.
This is an example of the faster whisper int8 base model being used to generate captions while someone is speaking.
This is an example of the Faster Whisper float32 base model being used to generate captions while someone is speaking.
(env_moonshine_faster_whisper) parallels@ubuntu-linux-2404:~$
```

Expand Down
4 changes: 0 additions & 4 deletions moonshine/demo/live_captions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
LOOKBACK_CHUNKS = 5
MARKER_LENGTH = 6
MAX_LINE_LENGTH = 80
SHOW_NEW_CAPTION = False # Stacks cached captions above scrolling captions.

# These affect live caption updating - adjust for your platform speed and model.
MAX_SPEECH_SECS = 15
Expand Down Expand Up @@ -83,9 +82,6 @@ def end_recording(speech, marker=""):
def print_captions(text, new_cached_caption=False):
"""Prints right justified on same line, prepending cached captions."""
print('\r' + " " * MAX_LINE_LENGTH, end='', flush=True)
if SHOW_NEW_CAPTION and new_cached_caption:
print('\r', end='', flush=True)
print(caption_cache[-1][:-MARKER_LENGTH])
if len(text) > MAX_LINE_LENGTH:
text = text[-MAX_LINE_LENGTH:]
elif text != "\n":
Expand Down

0 comments on commit 6a277b3

Please sign in to comment.