hans00 commited on
Commit
e3b3e58
·
verified ·
1 Parent(s): 503b0af

Model card: Python usage (codec_cpp.TTS)

Browse files
Files changed (1) hide show
  1. README.md +24 -0
README.md CHANGED
@@ -100,6 +100,30 @@ Clone a voice from a few seconds of clean speech (it works across languages):
100
  All `tts-cli` options (voices, voice cloning, sampling, GPU) are described in the [codec.cpp README](https://github.com/mybigday/codec.cpp#text-to-speech).
101
 
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  ## React Native (llama.rn)
104
 
105
  [llama.rn](https://github.com/mybigday/llama.rn) loads the same two files on iOS and Android:
 
100
  All `tts-cli` options (voices, voice cloning, sampling, GPU) are described in the [codec.cpp README](https://github.com/mybigday/codec.cpp#text-to-speech).
101
 
102
 
103
+ ## Python
104
+
105
+ The `codec_cpp` package runs the same pipeline (it builds codec.cpp with its
106
+ bundled llama.cpp, so it needs CMake and a C++ compiler):
107
+
108
+ ```bash
109
+ pip install "codec-cpp @ git+https://github.com/mybigday/codec.cpp" huggingface_hub soundfile
110
+ ```
111
+
112
+ ```python
113
+ import codec_cpp, soundfile
114
+ from huggingface_hub import hf_hub_download
115
+
116
+ tts = codec_cpp.TTS(hf_hub_download("BricksDisplay/Chatterbox-Multilingual-TTS-GGUF", "chatterbox-mtl-t3-q8_0.gguf"),
117
+ hf_hub_download("BricksDisplay/Chatterbox-Multilingual-TTS-GGUF", "chatterbox-mtl-codec-q8_0.gguf"))
118
+ audio, sr = tts.synthesize("[en]hello, this is chatterbox speaking.")
119
+ soundfile.write("out.wav", audio, sr)
120
+ ```
121
+
122
+ `tts.voices()` lists the builtin voices; `ref_audio=` clones a voice where the
123
+ model supports it; `tts.stream(text)` yields audio as it is generated. More in
124
+ the [Python docs](https://github.com/mybigday/codec.cpp/tree/main/python).
125
+
126
+
127
  ## React Native (llama.rn)
128
 
129
  [llama.rn](https://github.com/mybigday/llama.rn) loads the same two files on iOS and Android: