### Setup and Development Commands Source: https://github.com/atasoglu/seda/blob/main/CLAUDE.md Commands for setting up the environment, installing hooks, linting, running the demo, tests, and the microphone example. Always use uv instead of bare pip or python. ```bash uv sync --all-extras # set up the environment uv run prek install # install git hooks uv run prek run --all-files # lint and format, same as CI uv run python -m sedalib.demo.stt # Gradio demo uv run pytest # tests; model tests need SEDA_TEST_MODEL uv run --group examples python examples/streaming.py # microphone example ``` -------------------------------- ### Install and run the Gradio demo Source: https://github.com/atasoglu/seda/blob/main/README.md Install the demo extra and launch the Gradio app with live microphone streaming, file transcription, a control panel, and latency stats. ```bash pip install "sedalib[demo]" python -m sedalib.demo.stt ``` -------------------------------- ### Development setup and test commands Source: https://github.com/atasoglu/seda/blob/main/README.md Sync dependencies, install pre-commit hooks, and run tests. Tests that need a model are skipped unless SEDA_TEST_MODEL is set. ```bash uv sync --all-extras uv run prek install # ruff lint and format hooks uv run pytest # tests that need a model are skipped SEDA_TEST_MODEL=atasoglu/seda-v0.2,atasoglu/seda-v0.1 uv run pytest # with models ``` -------------------------------- ### Install sedalib with pip Source: https://github.com/atasoglu/seda/blob/main/README.md Install the core package. The optional [format] extra adds digits, punctuation, and casing to the output. Requires Python 3.10 or newer. ```bash pip install sedalib ``` ```bash pip install "sedalib[format]" # adds digits, punctuation and casing to the output ``` -------------------------------- ### Stream live audio with Recognizer.stream() Source: https://github.com/atasoglu/seda/blob/main/README.md Feed small audio chunks (e.g., 100 ms) to a stream. accept returns the current partial transcript; is_endpoint turns true after a 0.25 s pause (endpoint_silence). end_utterance returns the final text and starts the next utterance. Call stream.finish() at the end of audio to flush remaining frames. ```python stream = recognizer.stream() for chunk in microphone_chunks(): # e.g. 100 ms of audio at a time partial = stream.accept(chunk, sample_rate=16000) print(partial) if stream.is_endpoint: print("final:", stream.end_utterance()) ``` -------------------------------- ### Transcribe a WAV file with Recognizer Source: https://github.com/atasoglu/seda/blob/main/README.md Load a 16-bit PCM WAV file as mono float samples in [-1, 1] with its sample rate, then transcribe the full waveform. The model is downloaded once and cached. Audio at other sample rates is resampled automatically. ```python from sedalib import Recognizer, read_wav samples, sample_rate = read_wav("audio.wav") recognizer = Recognizer.from_pretrained() # downloads the model once and caches it text = recognizer.transcribe(samples, sample_rate) print(text) ``` -------------------------------- ### Recognizer(path) Source: https://github.com/atasoglu/seda/blob/main/README.md Loads a SEDA model from a local directory that has already been downloaded. This is an alternative to from_pretrained for offline usage. ```APIDOC ## Recognizer(path) ### Description Loads a SEDA model from a local directory that has already been downloaded. This is an alternative to from_pretrained for offline usage. ### Method Constructor ### Endpoint Recognizer(path: str) ### Parameters #### Path Parameters - **path** (str) - Required - Path to the model directory. ### Request Example ```python recognizer = Recognizer("path/to/model_dir") ``` ### Response #### Success Response (200) - **recognizer** (Recognizer) - A recognizer instance. #### Response Example ```python ``` ``` -------------------------------- ### Recognizer.from_pretrained Source: https://github.com/atasoglu/seda/blob/main/README.md Loads a SEDA speech recognition model from a Hugging Face repository or local directory. This is the primary entry point for creating a recognizer instance. ```APIDOC ## Recognizer.from_pretrained ### Description Loads a SEDA speech recognition model from a Hugging Face repository or local directory. This is the primary entry point for creating a recognizer instance. ### Method Constructor ### Endpoint Recognizer.from_pretrained( model_id: str, revision: Optional[str] = None, mode: str = "balanced", use_lm: Optional[bool] = None, two_pass: Optional[bool] = None, chunk: Optional[int] = None, punctuate: bool = False, num_threads: int = 1, vad: Optional[bool] = None, endpoint_silence: Optional[float] = None ) ### Parameters #### Path Parameters - **model_id** (str) - Required - Hugging Face repo id or local path to model directory. #### Query Parameters - **revision** (str) - Optional - Pin a branch, tag, or commit. - **mode** (str) - Optional - Decoding mode: "fast", "balanced", or "accurate". Default is "balanced". - **use_lm** (bool) - Optional - Override the mode: rescore with the language model. - **two_pass** (bool) - Optional - Override the mode: decode each utterance again for the final text. - **chunk** (int) - Optional - Override the mode: 32 or 64 frames (0.64 or 1.28 s per streaming step). - **punctuate** (bool) - Optional - Enable digits, punctuation, casing, and apostrophes in final texts. Default is False. - **num_threads** (int) - Optional - CPU threads per model. Default is 1. - **vad** (bool) - Optional - Use Silero VAD for end of speech. Default is if the model ships it. - **endpoint_silence** (float) - Optional - Pause that ends an utterance, in seconds. Default is 0.25 with VAD, 1.2 without. ### Request Example ```python recognizer = Recognizer.from_pretrained( "atasoglu/seda-v0.2", mode="accurate", punctuate=True, num_threads=2 ) ``` ### Response #### Success Response (200) - **recognizer** (Recognizer) - A configured recognizer instance. #### Response Example ```python ``` ``` -------------------------------- ### Recognizer.from_pretrained options Source: https://github.com/atasoglu/seda/blob/main/README.md Configure the SEDA recognizer with mode, language model, two-pass decoding, chunk size, punctuation, threads, VAD, and endpoint silence. Overrides for mode are available via use_lm, two_pass, and chunk. Defaults: balanced mode, VAD if shipped, endpoint silence 0.25 s with VAD, 1.2 s without. ```python Recognizer.from_pretrained( "atasoglu/seda-v0.2", # Hugging Face repo id revision=None, # pin a branch, tag or commit mode="balanced", # "fast", "balanced" or "accurate" use_lm=None, # override the mode: rescore with the language model two_pass=None, # override the mode: decode each utterance again for the final text chunk=None, # override the mode: 32 or 64 frames (0.64 or 1.28 s per streaming step) punctuate=False, # digits, punctuation, casing and apostrophes in final texts (needs [format]) num_threads=1, # CPU threads per model vad=None, # Silero VAD for the end of speech (default: if the model ships it) endpoint_silence=None, # pause that ends an utterance, in s (default 0.25 with the VAD, 1.2 without) ) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.