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 (GigasttFfiError → 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 | GigasttFfiError: 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). Python
wheels are published (pip install gigastt). A SwiftPM package already ships
via the C-ABI gigastt-ffi xcframework (packaging/swift/Package.swift,
attached to GitHub releases); the UniFFI-based Swift package and the Android
AAR are still in progress.
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.GigasttFfiError.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.
Metadata
Release files for gigastt 2.22.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| gigastt-2.22.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| gigastt-2.22.0-py3-none-manylinux_2_28_x86_64.whl | Python 3 | none | Linux glibc 2.28+ x86-64 | Details |
| gigastt-2.22.0-py3-none-manylinux_2_28_aarch64.whl | Python 3 | none | Linux glibc 2.28+ ARM64 | Details |
| gigastt-2.22.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details |
Total release size: 42.6 MB
Release files / gigastt-2.22.0-py3-none-win_amd64.whl
| Download URL | gigastt-2.22.0-py3-none-win_amd64.whl |
|---|---|
| Size | 8.9 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
157ca71b26003ba7edd8a7e88f24c555a133dbc2f1f2b8efaa3035166d3fba7b
|
|
BLAKE2b-256 checksum How to use checksums |
85b105e87b6db862f2f90e57740d61109ac6e83aabb52874012cfea30355a795
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / gigastt-2.22.0-py3-none-manylinux_2_28_x86_64.whl
| Download URL | gigastt-2.22.0-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 11.8 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
9fc4cb6c925267b8474615a4d9629cbe8a97d4014819f7b14ef495b4e39c3d47
|
|
BLAKE2b-256 checksum How to use checksums |
b98d0cf27190f8789a7b4458c318c3f3572d5365ce74de4b57e0423cf9124249
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / gigastt-2.22.0-py3-none-manylinux_2_28_aarch64.whl
| Download URL | gigastt-2.22.0-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 12.4 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
b0c5ccdb2dbaeeb2c489c8c1c86c947432d9a8d89256b48ce7063843396b60d8
|
|
BLAKE2b-256 checksum How to use checksums |
f64f6acaa8134c6b09a8c4a27e1adcc5a91ef41aa0a3158250045a657230e624
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / gigastt-2.22.0-py3-none-macosx_11_0_arm64.whl
| Download URL | gigastt-2.22.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 9.5 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
46f9a5bfc698f06d7a9a67dd29b4e6e6ecf3ce8afb62e91fcd959d2882a0e21b
|
|
BLAKE2b-256 checksum How to use checksums |
1b7c007129e44be2476459d6ba461bce6d825ffe25796b1c3660359d27baf30e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|