Commit Graph

604 Commits

Author SHA1 Message Date
Vineet Suryan f2f769532b Merge pull request #442 from boxerab/unify-translate-flags
Clarify --translate vs --enable_translation CLI flags
2026-05-26 13:25:23 +05:30
Vineet Suryan cdc661ce28 Merge pull request #434 from nightcityblade/fix/issue-405
docs: fix setup instructions reported in #405
2026-05-26 13:17:37 +05:30
Aaron Boxer 8396763444 fix: set proper mock_info attributes in SSE streaming tests
MagicMock auto-attributes are not JSON serializable. Set language,
language_probability, and duration explicitly. Also exclude metadata
events from segment count assertion.
2026-05-25 09:44:21 -04:00
Aaron Boxer 8ac98dceec feat: add SSE streaming for REST transcription endpoint
- stream=true now returns text/event-stream with per-segment SSE events
- Each segment yields 'data: {json}' followed by 'data: [DONE]'
- Error events streamed as 'data: {"error": ...}'
- Temp files cleaned up in finally block
- 5 new tests in test_server_extended.py (183 total passing)
2026-05-25 09:44:21 -04:00
Aaron Boxer 8bde966c1e docs: remove features from README that moved to Aavaaz
Remove authentication, rate limiting, and auto-reconnect documentation
since these features now live in the Aavaaz project.
2026-05-15 10:45:31 -04:00
Aaron Boxer dc4a707f9a chore: add .gitignore to exclude __pycache__, virtualenvs, and build artifacts 2026-05-15 10:45:31 -04:00
Aaron Boxer c028c4b584 feat: add segment_post_processor hook for external plugins
Add a minimal, non-breaking hook to WhisperLive that allows external
projects to post-process transcription segments before they are sent
to the client.

Changes:
- ServeClientBase: add segment_post_processor attribute (default None)
- ServeClientBase.send_transcription_to_client: apply post_processor
  per-segment with error handling (falls back to original segment)
- TranscriptionServer: add segment_post_processor parameter to run()
  and wire it to each client on creation

This enables downstream projects to plug in custom processing
(e.g. formatting, PII redaction, diarization tagging) without
modifying WhisperLive core code.
2026-05-15 10:45:31 -04:00
Aaron Boxer 4e31f8c61b Add word-level timestamps and confidence scores
- New word_timestamps option (default False) in client handshake
- When enabled, each segment includes 'words' array with per-word
  start/end times and probability scores
- Wired through entire pipeline: client → server → backend → transcribe()
- Words include timestamp_offset for accurate absolute times
- REST API already supported word timestamps; now WebSocket does too
- Added 9 unit tests for word timestamp extraction and formatting
2026-05-15 10:35:27 -04:00
Aaron Boxer 18de3eacc7 Document all new features in README
- Added 'Advanced Features' section with 8 subsections
- Word-level timestamps: WebSocket JSON example
- Custom vocabulary / hotwords: usage and REST API support
- Speaker diarization: setup, pyannote dependency, output format
- Authentication: API key for REST + WebSocket
- Rate limiting: per-IP RPM configuration
- Auto-reconnect: max_retries / retry_delay
- Batch inference: CLI flags
- Raw PCM input: int16 normalization
- Updated table of contents
2026-05-15 09:01:48 -04:00
Aaron Boxer 18b897277f Add real-time speaker diarization support
- New whisper_live/diarization.py: SpeakerDiarizer with online clustering
- Uses pyannote.audio speaker embeddings (optional dependency)
- Cosine similarity threshold for speaker matching (default 0.55)
- Running average embedding update for speaker stability
- Configurable max_speakers limit (default 10)
- Client options: enable_diarization, max_speakers
- Segments include 'speaker' field when diarization is active
- Graceful fallback: logs warning if pyannote not installed
- Added 12 unit tests (mock-based, no GPU required)
2026-05-13 10:50:59 -04:00
Aaron Boxer 3d63e82571 fix: add skip decorator to TestStartMetricsServer for CI without prometheus_client 2026-05-13 10:45:40 -04:00
Aaron Boxer ced4bdb737 feat: add Prometheus metrics instrumentation
- New whisper_live/metrics.py with Counter, Gauge, Histogram metrics
- Track connections (opened/closed/rejected), transcription latency,
  audio processed, segments emitted, REST requests, and errors
- All metric helpers are no-ops when prometheus_client not installed
- --metrics_port CLI flag to expose /metrics endpoint (0 = disabled)
- Metrics integrated into server.py, base.py at key instrumentation points
- 17 new tests in tests/test_metrics.py (178 total passing)
2026-05-13 10:45:40 -04:00
Aaron Boxer 4210697ca6 Add custom vocabulary / hotwords support 2026-05-13 10:32:28 -04:00
Aaron Boxer b534f9d249 Clarify --translate vs --enable_translation CLI flags
- --translate: Whisper built-in to-English translation (task=translate)
- --enable_translation: M2M100 any-to-any translation backend
- Added warning when both flags are used simultaneously
- Updated help text to distinguish the two features
2026-05-11 20:05:34 -04:00
Vineet Suryan 9a71a95ca8 Merge pull request #441 from boxerab/fix-clear-screen-shell-injection
Avoid clear screen shell injection by using ANSI escape codes
2026-05-08 17:36:11 +02:00
Vineet Suryan 485b211072 Merge pull request #440 from boxerab/input-validation-server-params
Validate server parameters on startup
2026-05-08 17:35:26 +02:00
Vineet Suryan 19847784ae Merge pull request #439 from boxerab/bounded-transcript-memory
Bound transcript memory and translation queue size
2026-05-08 17:34:41 +02:00
Vineet Suryan 52d94bf1fb Merge pull request #438 from boxerab/thread-safety-client-manager
Add thread safety to client manager with threading lock
2026-04-21 13:29:54 +02:00
Vineet Suryan 1c663d0bba Merge pull request #437 from boxerab/rawpcm
audio: add support for raw pcm input via server flag
2026-04-21 13:17:47 +02:00
Vineet Suryan 298a01f1b0 Merge pull request #436 from boxerab/testing
CI: expand test suite coverage
2026-04-20 17:58:48 +02:00
Aaron Boxer a6147a6745 Replace os.system() in clear_screen() with ANSI escape codes
- Eliminates shell injection risk from os.system('clear'/'cls')
- Uses ANSI escape sequence \033[H\033[2J instead
- Removed unused os import
- Added test verifying ANSI codes are used
2026-04-17 09:31:00 -04:00
Aaron Boxer 18bce1864a Validate server parameters on startup
- max_clients must be >= 1
- max_connection_time must be > 0
- batch_max_size must be >= 1 (when batch enabled)
- batch_window_ms must be >= 0 (when batch enabled)
- Added 5 new tests for parameter validation
2026-04-17 09:30:19 -04:00
Aaron Boxer 9e5e4a9970 Bound transcript memory and translation queue size
- Add MAX_TRANSCRIPT_LENGTH (500) and MAX_TRANSLATION_QUEUE_SIZE (100)
  class constants to ServeClientBase
- Trim transcript and text lists after each update_segments() call
- Create translation queue with maxsize to prevent unbounded growth
- Added tests for _trim_transcript()
2026-04-17 09:29:38 -04:00
Aaron Boxer 81cdbbca95 Add thread safety to ClientManager with threading.Lock
- All ClientManager methods (add_client, get_client, remove_client,
  get_wait_time, is_server_full, is_client_timeout) now protected by
  a threading.Lock
- cleanup() called outside the lock to avoid holding it during I/O
- is_server_full() computes wait time inline under lock instead of
  calling get_wait_time() to avoid nested lock acquisition
- Added concurrent thread safety tests for add/remove and get operations
2026-04-17 09:27:37 -04:00
Aaron Boxer f5340ddf1e audio: add support for raw pcm input via server flag
fixes #
2026-04-17 09:21:06 -04:00
Aaron Boxer b1cd51ac8a CI: expand test suite coverage
these new test cover issues such as thread safety, VAD thresholding,
message routing, error handling etc. that weren't covered by existing
tests. Mocking is used to avoid dependencies on GPU, ONNX etc.
2026-04-17 09:05:34 -04:00
Vineet Suryan e41324bf03 Merge pull request #435 from nightcityblade/fix/issue-327
fix: render transcript text safely in browser extensions
2026-04-16 12:37:33 +02:00
nightcityblade 31efff9330 fix: render transcript text safely in browser extensions 2026-04-15 23:09:39 +08:00
nightcityblade 68a8b57e66 docs: fix setup instructions errors reported in #405
- Clarify that setup.sh installs portaudio system dependency and list
  per-distro package names
- Add missing --gpus all flag to TensorRT Docker run command
- Fix Docker TensorRT example showing multiple --trt_model_path on one
  command (should be separate alternatives)
- Document --trt_py_session flag as workaround for TensorRT C++ session
  crashes (CrossAttentionMask warnings)

Closes #405

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:09:40 +08:00
Vineet Suryan 6de5c87d2f Bump version v0.8.0 v0.8.0 2026-03-17 14:48:07 +05:30
Vineet Suryan 8e09d16ee4 Merge pull request #430 from makaveli10/vineet/fix-run-client
Fix crash when no --files provided; use microphone input instead
2026-03-17 14:46:57 +05:30
Xiaoliang Gao 4943c25ff7 Fix crash when no --files provided; use microphone input instead 2026-03-17 14:36:20 +05:30
Vineet Suryan 710bdffb51 Merge pull request #429 from makaveli10/vineet/update-setup-packages
Expose __version__ in package root and update dependencies in setup.py
2026-03-17 14:19:15 +05:30
makaveli10 5f0010d720 Expose __version__ in package root and update dependencies in setup.py
Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2026-03-17 13:34:34 +05:30
Vineet Suryan 6fcae6a30c Merge pull request #425 from nightcityblade/fix/issue-377
feat: make display_segments configurable in Client/TranscriptionClient
2026-03-16 10:34:29 +05:30
Vineet Suryan bc441dea23 Merge pull request #427 from ianwh02/fix/batch-single-vad-none
Fix NoneType crash in _process_single when VAD filters all audio
2026-03-13 17:02:43 +05:30
ianwh02 89466f7b77 Fix NoneType crash in _process_single when VAD filters all audio
When VAD removes all speech from an audio chunk, transcriber.transcribe() returns (None, info). Calling list(None) raises TypeError. The _process_multi path already handles this case; this aligns _process_single to match.
2026-03-11 16:48:23 +00:00
nightcityblade 6ae57c81cd feat: add --n_display_segments CLI arg to run_client.py 2026-03-11 00:05:07 +08:00
Vineet Suryan 5d8629ea0c Merge pull request #422 from ianwh02/feature/batch-inference
Add cross-client GPU batch inference for faster_whisper backend
2026-03-09 23:01:28 +05:30
ianwh02 e7e78a7151 Add unit tests for BatchInferenceWorker 2026-03-09 16:18:36 +00:00
ianwh02 3508b39584 Fix missing batch_config init causing CI test hang 2026-03-09 11:42:15 +00:00
nightcityblade 067573a510 feat: make display_segments configurable in Client/TranscriptionClient
Replace hardcoded [-4:] truncation with a configurable display_segments
parameter (default: 4) in both Client and TranscriptionClient classes.

Fixes #377
2026-03-08 12:19:54 +08:00
ianwh02 e8bd4fd532 Add cross-client GPU batch inference for faster_whisper backend 2026-02-26 00:00:51 +00:00
Marcus Edel f8869906b0 Merge pull request #419 from makaveli10/bump-whisper-version
Bump openai-whisper version to 20250625.
2026-02-20 08:04:31 -05:00
makaveli10 9fa7005511 Bump openai-whisper version to 20250625
Resolves pkg_resources missing during wheel build

Signed-off-by: makaveli10 <vineet.suryan@collabora.com>
2026-02-11 12:39:38 +00:00
Vineet Suryan e48d16f923 Merge pull request #398 from AlexStansfield/feature/faster-whisper-1.2.0
feat: update to support faster whisper 1.2.0
2026-02-11 17:57:05 +05:30
Vineet Suryan 98fcc5110b Merge pull request #418 from JenySadadia/enable-timestamps
Enable timestamps for transcripted text
2026-02-11 17:51:58 +05:30
Jeny Sadadia 5e33aa2a7e Enable timestamps for transcripted text
Add `--enable-timestamps` option to `run_client.py`
script to print out transcripted text with timestamps.

Sample output with translation enabled:
```
[0.000 -> 7.440]  And so, my fellow Americans, ask not what your country can do for you.
[7.440 -> 10.300]  Ask what you can do for your country.

TRANSLATION to fr:
[0.000 -> 7.440] Et donc, mes camarades américains, ne demandez pas ce que votre pays peut faire pour vous.
[7.440 -> 10.300] Demandez ce que vous pouvez faire pour votre pays.
```

Signed-off-by: Jeny Sadadia <jeny.sadadia@collabora.com>
2026-02-10 15:43:20 +05:30
Vineet Suryan 6c8142a9d2 Merge pull request #415 from JenySadadia/run-client-docs
README.md: add instructions for running client
2026-02-06 20:03:19 +05:30
Aaron Boxer 29ee640409 api: add support OpenAI REST transcription api 2026-02-05 22:31:59 -05:00