Add Rust server usage example (#32)

* Run Ruff on tts_mlx.py

* Add tts_rust_server.py example

* Remove unused HF repo arguments and reset audio output data in TTS server script
This commit is contained in:
Václav Volhejn
2025-07-03 09:47:50 +02:00
committed by GitHub
parent d92e4c2695
commit ef52b8ef0f
4 changed files with 233 additions and 22 deletions

View File

@@ -239,7 +239,35 @@ and just prefix the command above with `uvx --with moshi`.
<details>
<summary>Rust server</summary>
Example coming soon.
The Rust implementation provides a server that can process multiple streaming
queries in parallel.
In order to run the server, install the [moshi-server
crate](https://crates.io/crates/moshi-server) via the following command. The
server code can be found in the
[kyutai-labs/moshi](https://github.com/kyutai-labs/moshi/tree/main/rust/moshi-server)
repository.
```bash
cargo install --features cuda moshi-server
```
Then the server can be started via the following command using the config file
from this repository.
```bash
moshi-server worker --config configs/config-tts.toml
```
Once the server has started you can connect to it using our script as follows:
```bash
# From stdin, plays audio immediately
echo "Hey, how are you?" | python scripts/tts_rust_server.py - -
# From text file to audio file
python scripts/tts_rust_server.py text_to_say.txt audio_output.wav
```
</details>
<details>