Skip to content

Add optional TwelveLabs Pegasus transcription backend - #68

Open
mohit-twelvelabs wants to merge 1 commit into
mayeaux:masterfrom
mohit-twelvelabs:feat/twelvelabs-integration
Open

Add optional TwelveLabs Pegasus transcription backend#68
mohit-twelvelabs wants to merge 1 commit into
mayeaux:masterfrom
mohit-twelvelabs:feat/twelvelabs-integration

Conversation

@mohit-twelvelabs

Copy link
Copy Markdown

Hi! I'm Mohit, I work at TwelveLabs (@mohit-twelvelabs).

This PR adds TwelveLabs Pegasus as an optional transcription backend alongside Whisper.

What it adds

  • A new transcribe/transcribe-pegasus.js module that uploads a file to TwelveLabs, indexes it with the Pegasus video-understanding model, and asks it to return a WebVTT transcript with timestamps.
  • The Pegasus output is written to the same .vtt/.srt/.txt files that Whisper produces, so the existing completion pipeline (file moving, translation, websocket updates, processing_data.json) is reused unchanged. I refactored the Whisper close handler into a named onTranscriptionComplete function so both backends share one code path.
  • A Pegasus (TwelveLabs) option in the model dropdown.

Why it helps

Pegasus runs in the cloud, so it can transcribe uploads without a local GPU or even a local Whisper install — useful for low-powered hosts or as a fallback. It also handles video natively.

Opt-in / non-breaking

  • The Pegasus model option only appears when TWELVELABS_API_KEY is set; with no key the app behaves exactly as before (the dropdown and default medium Whisper model are unchanged).
  • The only change to shared code is making which.sync('whisper') use { nothrow: true } so the app can still boot on Pegasus-only setups; Whisper users are unaffected.

How it was tested

  • node transcribe/transcribe-pegasus.test.js — no-network unit tests for the WebVTT→SRT/TXT conversion and cue-number cleanup (all assertions pass).
  • npm run lint passes clean on the full repo.
  • End-to-end smoke test against the live TwelveLabs API: a sample video was uploaded, indexed, and analyzed, and valid .vtt/.srt/.txt files were produced. A speech sample returns correctly timestamped WebVTT cues.

You can grab a free API key at https://twelvelabs.io — there's a generous free tier.

Adds Pegasus as an opt-in transcription backend alongside Whisper. When
TWELVELABS_API_KEY is set, a 'Pegasus (TwelveLabs)' option appears in the
model dropdown; selecting it uploads and indexes the file with TwelveLabs
and writes .srt/.vtt/.txt subtitles via the same completion pipeline as
Whisper. Default Whisper behavior is unchanged when no key is configured.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant