poly-server
English · Português
Speech language detection and offline UI translation server for Poly, voice-driven interfaces for self-service kiosks.
- Speech → language with faster-whisper.
- UI translation with Argos Translate, fully offline, with an English pivot when there's no direct language pair and a persistent SQLite cache.
- Two audio modes: the server's own microphone (kiosk: screen and server on the same machine) or audio streamed from the browser.
- Nothing leaves the device: no cloud APIs.
Install
# CPU-only PyTorch first (Argos needs it); avoids ~3 GB of CUDA libraries
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install "poly-server[mic]"
The mic extra enables local microphone capture (needs PortAudio:
sudo apt install libportaudio2 on Debian/Ubuntu). Skip it if audio only
comes from the browser.
Run
poly-server serve # http://127.0.0.1:8000, local microphone
poly-server serve --no-mic # browser audio only
poly-server devices # list microphones
poly-server serve --mic-device 2
Offline kiosks
Download everything once during installation, then run without network:
poly-server download --base en --languages pt,es,fr,ar,ja,zh
poly-server serve --offline
Configuration
Every option can be set with a POLY_* environment variable:
| Variable | Default | |
|---|---|---|
POLY_HOST / POLY_PORT |
127.0.0.1 / 8000 |
|
POLY_CORS_ORIGINS |
* |
Comma-separated allowed origins. |
POLY_MIC |
true |
Capture the local microphone. |
POLY_MIC_DEVICE |
system default | Input device index or name. |
POLY_WHISPER_MODEL |
base |
tiny, base, small, medium, large-v3. |
POLY_WHISPER_DEVICE |
auto |
cpu, cuda, auto. |
POLY_WHISPER_COMPUTE_TYPE |
int8 |
|
POLY_VAD_MODE |
2 |
0 (lenient) to 3 (aggressive) voice detection. |
POLY_END_TRIGGER_MS |
600 |
Silence that ends an utterance. |
POLY_MAX_UTTERANCE_SEC |
12 |
|
POLY_CACHE_DIR |
~/.cache/poly-server |
Models and translation cache. |
POLY_AUTO_DOWNLOAD |
true |
Download translation packages on demand. |
API
| Endpoint | |
|---|---|
GET /health |
{ ok, version, mic } |
POST /i18n/auto-translate |
{ source_lang, target_lang, texts: { key: text } } → { target_lang, texts }. Returns 422 with code: "unsupported_language_pair" when no translation exists. |
WS /ws |
Recognition events from the local microphone, broadcast to every client. Send {"type":"config","listening":"manual"} to listen only on demand, then {"type":"listen","action":"start"|"stop"}; the server replies with {"type":"listening","listening":bool} and {"type":"speech_start"}. |
WS /ws/audio |
Send binary PCM16 LE mono 16 kHz; receive {"type":"speech_start"} / {"type":"utterance_end"} as speech starts and ends, then the recognition event. Text messages: {"type":"flush"} recognizes the speech in progress, {"type":"reset"} discards it. |
Event: { "type": "asr", "language": "pt", "confidence": 0.97, "text": "...", "latency_sec": 1.4 }
Embedding
from poly_server import Settings, create_app
app = create_app(Settings(mic=False, whisper_model="small"))
create_app also accepts custom recognizer and translator objects, to plug
in another speech model or translation service.
License
MIT
Português
Servidor de detecção do idioma falado e tradução offline de interfaces para o Poly.
- Fala → idioma com faster-whisper.
- Tradução com Argos Translate, 100% offline, passando pelo inglês quando não há pacote direto entre dois idiomas, e com cache em disco (SQLite).
- Dois modos de áudio: o microfone do próprio servidor (quiosque) ou o áudio enviado pelo navegador.
- Nada sai do aparelho: nenhuma API na nuvem.
Instalação, execução e configuração: veja os comandos acima. Para quiosques
sem internet, rode poly-server download na instalação e depois
poly-server serve --offline.
Metadata
Release files for poly-server 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| poly_server-0.1.0.tar.gz | 751.6 kB | With provenance | Details for poly_server-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| poly_server-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for poly_server-0.1.0-py3-none-any.whl |
Total release size: 769.5 kB
Release files / poly_server-0.1.0.tar.gz
| Download URL | poly_server-0.1.0.tar.gz |
|---|---|
| Size | 751.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37aa2c74fba4831fd27ddc97dd23019ec1fc5699d59aa5d4fb33a7f0ca424f52
|
|
BLAKE2b-256 checksum How to use checksums |
4f2aa7991e5f2266ac5049f3458285a25e93a2d953ef2bbd5a2f47f41cd707a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logRelease files / poly_server-0.1.0-py3-none-any.whl
| Download URL | poly_server-0.1.0-py3-none-any.whl |
|---|---|
| Size | 17.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
914d96437c56d4942c49059179cdd9b46b5ca3ebf614db2e2c49780ec5db2404
|
|
BLAKE2b-256 checksum How to use checksums |
84eed2b394850e0bb3f84bfaea28191154b21e1001f106e580dc98c87e9965ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logSecurity for poly-server 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for poly_server-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.