models/transcriber.py

LaunchStack · services/transcription/app/models/transcriber.py · python · Apache-2.0
voice

Speech-to-Text transcriber wrapper. Uses OpenAI Whisper for local audio transcription, replacing API calls to reduce cost. `whisper` (and therefore torch) is imported lazily inside ``Transcriber.__init__`` so that importing this module — and anything that imports it, like ``app.m

# Source: https://github.com/Deodat-Lawson/LaunchStack | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""
Speech-to-Text transcriber wrapper.
Uses OpenAI Whisper for local audio transcription,
replacing API calls to reduce cost.

`whisper` (and therefore torch) is imported lazily inside
``Transcriber.__init__`` so that importing this module — and anything that
imports it, like ``app.main`` — stays cheap and testable. The test suite
never constructs a real ``Transcriber``; it injects a fake on
``app.state.transcriber`` instead (see ``tests/conftest.py``).
"""

import logging
import math
import tempfile
from pathlib import Path

logger = logging.getLogger(__name__)


def confidence_

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key