Add Colab example (#67)

Thank you @HarishDevLab for the suggestion, I just reimplemented the PR
to link to a version-controlled notebook.
This commit is contained in:
Václav Volhejn
2026-01-19 10:29:53 +00:00
committed by GitHub
parent 83eac9f5c7
commit 6f9dd250c2
2 changed files with 88 additions and 1 deletions
+8 -1
View File
@@ -59,6 +59,8 @@ for each voice.
* [azelma](https://huggingface.co/kyutai/tts-voices/blob/main/vctk/p303_023.wav)
The `--voice` argument can also take a plain wav file as input for voice cloning.
You can use your own or check out our [voice repository](https://huggingface.co/kyutai/tts-voices).
Feel free to check out the [generate documentation](https://github.com/kyutai-labs/pocket-tts/tree/main/docs/generate.md) for more details and examples.
For trying multiple voices and prompts quickly, prefer using the `serve` command.
@@ -76,6 +78,8 @@ You can check out the [serve documentation](https://github.com/kyutai-labs/pocke
## Using it as a Python library
You can try out the Python library on Colab [here](https://colab.research.google.com/github/kyutai-labs/pocket-tts/blob/main/docs/pocket-tts-example.ipynb).
Install the package with
```bash
pip install pocket-tts
@@ -90,7 +94,10 @@ import scipy.io.wavfile
tts_model = TTSModel.load_model()
voice_state = tts_model.get_state_for_audio_prompt(
"hf://kyutai/tts-voices/alba-mackenna/casual.wav"
"alba" # One of the pre-made voices, see above
# You can also use any voice file you have locally or from Hugging Face:
# "./some_audio.wav"
# or "hf://kyutai/tts-voices/expresso/ex01-ex02_default_001_channel2_198s.wav"
)
audio = tts_model.generate_audio(voice_state, "Hello world, this is a test.")
# Audio is a 1D torch tensor containing PCM data.