Skip to content
Projects

SergeyShk/Speech-to-Text-Russian

View on GitHub

About

Распознавание русской речи: библиотека Python, CLI stt-ru, веб-интерфейс с REST API и Docker-образ на модели GigaAM-v3.

Systems & Infrastructure

How these counts are measured

Measured star growth

in 24h
0
in 7 days
+1
in 15 days
-1
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.en.md

Original

stt-ru

stt-ru

Speech-to-Text Russian - Russian speech recognition: a Python library, a CLI, a web service and a Docker image

Documentation · PyPI · Docker · Русский

Version Supported Python versions Build Ruff License Open in Colab


stt-ru recognizes Russian speech in recordings of conversations, lectures and dictation. Speech is recognized by the GigaAM-v3 model through onnx-asr: the text comes with punctuation and digits, the channels of a stereo recording are recognized as separate speakers, and the result is saved as subtitles and tables. The model runs on a CPU without PyTorch and on NVIDIA GPUs through ONNX Runtime.

  • The transcribe command - files and folders, results of every file and one summary file per batch, monitoring a folder for new recordings
  • Speaker separation - turns of different people in a single-track recording
  • Output formats - TXT, JSON, JSONL, SRT, VTT, ASS for Aegisub and CSV for spreadsheets
  • Python library - transcription of files and in-memory recordings, exporting the result
  • Models - any onnx-asr model: GigaAM, T-one, Vosk, Whisper and others; devices and speech detection parameters
  • Quality evaluation - WER, CER and speed of models on your own references
  • Web service - a web interface with a waveform and navigation by segments, a REST API, a queue and an access token
  • Docker - CPU and NVIDIA GPU images with the model inside

Installation

Python 3.11 to 3.14 is required: ONNX Runtime has no builds for 3.15 yet.

pip install stt-ru

Or with uv:

uv add stt-ru

Extras: ffmpeg - M4A, AAC and the sound of videos without an installed ffmpeg; service - the web interface and REST API; eval - quality evaluation. All at once:

pip install "stt-ru[ffmpeg,service,eval]"

The model (about 230 MB) is downloaded from Hugging Face on the first run. GPUs and working without internet are covered on the Installation page.

Quick start

stt-ru transcribe call.wav                                       # text to the console
stt-ru transcribe calls/ -o out/ -f srt,ass,csv --summary out/all.csv
stt-ru transcribe calls/ -o out/ --watch                         # folder monitoring
stt-ru transcribe meeting.mp3 --diarize                          # speaker separation
stt-ru evaluate eval.csv -m gigaam-v3-e2e-rnnt -m t-tech/t-one   # model comparison
stt-ru serve                                                     # http://127.0.0.1:8000
>>> from stt_ru import Transcriber

>>> result = Transcriber().transcribe("call.wav")
>>> for segment in result.segments:
...     print(segment.speaker, segment.start, segment.end, segment.text)
Канал 1 0.994 9.054 Наталья, благодарю вас за ожидание. По данному вопросу я сейчас ваш звонок переведу на специалиста профильного подразделения. Оставайтесь, пожалуйста, на линии.
Канал 0 3.49 3.934 Угу
Канал 0 7.682 8.222 Угу
Канал 1 9.634 12.638 Я в свою очередь с вами прощаюсь. Всего доброго, до свидания.
Канал 0 12.994 13.662 До свидания.

>>> result.save("call.srt")
PosixPath('call.srt')

The CLI messages and speaker names ("Канал N", Channel N) are in Russian.

Example notebooks are in the notebooks/ directory: quick start, call analytics, a long recording and subtitles, model evaluation, the web service from Python, speaker separation. Each opens in Colab; descriptions are on the Examples page. The notebooks are in Russian.

Docker

docker run -d -p 8000:8000 -e STT_RU_TOKEN=my-secret-token ghcr.io/sergeyshk/stt-ru           # web service
docker run --rm -v "$PWD:/data" ghcr.io/sergeyshk/stt-ru transcribe call.wav         # one file
docker run -d --gpus all -p 8000:8000 -e STT_RU_TOKEN=my-secret-token ghcr.io/sergeyshk/stt-ru:latest-gpu

The default model is already in the image: the container recognizes speech without network. Volumes, write permissions, Compose and the GPU image requirements are on the Docker page.

Development

The project uses uv for dependency management and ruff for linting and formatting.

git clone https://github.com/SergeyShk/Speech-to-Text-Russian.git
cd Speech-to-Text-Russian

make deps        # create the environment and install dependencies
make test        # run the tests and docstring examples (doctest)
make lint        # ruff + mypy
make docker      # build the Docker image

All commands - make help. The documentation is bilingual: Russian pages are docs/*.md, English ones are docs/*.en.md next to them; when editing a page, update both versions.

Before sending changes, install the hooks that run the linters on commit and the tests on push:

uv run pre-commit install

Contributing

Bug reports, ideas and pull requests are welcome, in Russian or English - issues are open. How the process works and what to check before a pull request is in CONTRIBUTING.md; the rules of conduct are in the code of conduct.

Project structure
  • docs - MkDocs documentation in Russian and English
  • docker - Docker images for CPU and NVIDIA GPU, Docker Compose files
  • src/stt_ru:
    • pipeline.py - transcription of files and in-memory recordings
    • result.py - transcription result: segments and recording information
    • batch.py - batch transcription of files and folder monitoring
    • cli.py - the stt-ru CLI
    • exceptions.py - library exceptions
    • audio - reading audio through soundfile and ffmpeg
    • asr - recognition with an onnx-asr model
    • vad - Silero VAD speech detection parameters
    • diarization - speaker separation
    • export - output formats
    • evaluation - quality evaluation on references
    • service - web interface, REST API and job queue
  • tests - tests mirroring the package structure

Authors

License

The code is distributed under the MIT license. The GigaAM-v3 model is distributed under the MIT license; other onnx-asr models have their own licenses. The licenses of the speaker separation models are on the Models page.

Explore related projects

Loading…