On-device Russian speech-to-text (GigaAM v3) — Python bindings (no cloud, no API keys)
Project description
gigastt-uniffi
Idiomatic Swift, Kotlin, and Python bindings for gigastt — on-device Russian speech-to-text — generated from one Rust source with UniFFI.
Wraps the synchronous gigastt-core engine: models are side-loaded (no HTTP download dependency) and inference uses the blocking pool path (no tokio runtime), so the bindings are lean. Errors are typed (GigasttError → Swift throws / Kotlin exceptions / Python exceptions) and objects are reference-counted (no manual free).
API
| Type | Methods |
|---|---|
Engine |
new(model_dir) · new_with_pool_size(model_dir, pool_size) · transcribe_file(path) -> Transcript |
Stream |
new(engine) · process_chunk(pcm16, sample_rate) -> [TranscriptSegment] · flush() -> [TranscriptSegment] |
| records | Transcript { text, words, duration_s } · TranscriptSegment { text, words, is_final } · Word { text, start_s, end_s, confidence, speaker } |
| errors | GigasttError: ModelNotFound · InvalidAudio · PoolExhausted · Inference · InvalidArgument |
process_chunk takes little-endian mono PCM16 and resamples to 16 kHz internally.
Generating the bindings
Build the cdylib, then run the version-pinned generator against it:
cargo build -p gigastt-uniffi
LIB=target/debug/libgigastt_uniffi.dylib # .so on Linux
cargo run -p gigastt-uniffi --bin uniffi-bindgen -- generate --library "$LIB" --language python --out-dir bindings/python
cargo run -p gigastt-uniffi --bin uniffi-bindgen -- generate --library "$LIB" --language swift --out-dir bindings/swift
cargo run -p gigastt-uniffi --bin uniffi-bindgen -- generate --library "$LIB" --language kotlin --out-dir bindings/kotlin
Generated bindings are build artifacts (bindings/ is git-ignored). Packaging them into a SwiftPM .xcframework, an Android .aar, and a PyPI wheel is the next step (prebuilt-artifacts task).
Python (quickstart, verified)
Install the prebuilt wheel — pip install gigastt — no compiler, no protoc, no
onnxruntime download (it is statically linked; the wheel is py3-none-<platform>,
one per platform across all Python 3.x). The ~215 MB model is side-loaded at
runtime. Wheels are built + published by .github/workflows/python-wheels.yml.
# pip install gigastt
import gigastt_uniffi as g
engine = g.Engine("/path/to/gigastt/models") # side-loaded model dir
t = engine.transcribe_file("recording.wav")
print(t.text) # -> "шестьдесят тысяч тенге сколько будет стоить"
for w in t.words:
print(w.text, w.start_s, w.end_s, w.confidence)
# streaming
s = g.Stream(engine)
for seg in s.process_chunk(pcm16_bytes, 16000):
print(seg.text)
print([seg.text for seg in s.flush()])
Errors surface as exceptions:
try:
g.Engine("/no/such/dir")
except g.GigasttError.ModelNotFound as e:
...
Features
coreml / cuda / nnapi forward to gigastt-core for hardware acceleration. The core dependency is lean (file-decode only — no net, no async-pool).
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gigastt-2.3.0-py3-none-win_amd64.whl.
File metadata
- Download URL: gigastt-2.3.0-py3-none-win_amd64.whl
- Upload date:
- Size: 9.0 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
974232009a2cc21127a8d4ee3d1ca183e907859d4f2f29857dda5f5984434de2
|
|
| MD5 |
8477552afe0d8b8c388ddb366fa3cf1d
|
|
| BLAKE2b-256 |
74089b7cc4580aeb9a575f7fc54daa5e5d8540d3aefe1cdd864f346fb1d1ad3d
|
File details
Details for the file gigastt-2.3.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: gigastt-2.3.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 9.8 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f58f6e2d4b681859915772fad82cc3c23224aa93321cce280d9b95397cc74ab5
|
|
| MD5 |
d2d53a6a9611e9d8242cacad2c6023c3
|
|
| BLAKE2b-256 |
8fa109d7c64cfacc16e23ae9d9b27fc08bdd5ccf953fcfde3d405ac19c1b88ed
|
File details
Details for the file gigastt-2.3.0-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: gigastt-2.3.0-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 10.4 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11c0d8dec93655dcadcca81b54a5bdde0f725f23b97f7d003ddf237ff16983e3
|
|
| MD5 |
f658a54d93f73bd0bcc33adc13cbc021
|
|
| BLAKE2b-256 |
effae05fbf2607e4e2e0cb86fc2d8b19fad618941f4677ca5960e649818e36b6
|
File details
Details for the file gigastt-2.3.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: gigastt-2.3.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.3 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.14.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba7d39c7f5261976975795c605e3c576d657bb72bff09093d113b1bc4a42b011
|
|
| MD5 |
35f0d8a12419eb04a6f7c6466f576794
|
|
| BLAKE2b-256 |
667858c2c8724fb4d0fdbdfa38aecfaa2aa17926b9bb4ad98bfacd47d20c5c2d
|