Update README.md
Browse files
README.md
CHANGED
@@ -101,16 +101,30 @@ pip install chatterbox-tts
|
|
101 |
|
102 |
# Usage
|
103 |
```python
|
|
|
|
|
104 |
import torchaudio as ta
|
105 |
from chatterbox.tts import ChatterboxTTS
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
ta.save("test-1.wav", wav, model.sr)
|
|
|
110 |
# If you want to synthesize with a different voice, specify the audio prompt
|
111 |
-
AUDIO_PROMPT_PATH="
|
112 |
wav = model.generate(text, audio_prompt_path=AUDIO_PROMPT_PATH)
|
113 |
-
ta.save("
|
114 |
```
|
115 |
See `example_tts.py` for more examples.
|
116 |
|
|
|
101 |
|
102 |
# Usage
|
103 |
```python
|
104 |
+
from pathlib import Path
|
105 |
+
|
106 |
import torchaudio as ta
|
107 |
from chatterbox.tts import ChatterboxTTS
|
108 |
+
from huggingface_hub import hf_hub_download
|
109 |
+
|
110 |
+
REPO_ID = "akhbar/chatterbox-tts-norwegian"
|
111 |
+
|
112 |
+
for fpath in ["ve.safetensors", "t3_cfg.safetensors", "s3gen.safetensors", "tokenizer.json", "conds.pt"]:
|
113 |
+
local_path = hf_hub_download(repo_id=REPO_ID, filename=fpath)
|
114 |
+
|
115 |
+
model = ChatterboxTTS.from_local(Path(local_path).parent, device="cuda")
|
116 |
+
|
117 |
+
text = (
|
118 |
+
"Det beste er godt nok, bare man kan få det."
|
119 |
+
"Dette ordtaket understreker at selv om man søker det beste, så kan det være vanskelig å oppnå, og at det man får kan være godt nok."
|
120 |
+
)
|
121 |
+
wav = model.generate(text, exaggeration=1.0, cfg_weight=0.5, temperature=0.4)
|
122 |
ta.save("test-1.wav", wav, model.sr)
|
123 |
+
|
124 |
# If you want to synthesize with a different voice, specify the audio prompt
|
125 |
+
AUDIO_PROMPT_PATH = "<voice_to_clone.wav>"
|
126 |
wav = model.generate(text, audio_prompt_path=AUDIO_PROMPT_PATH)
|
127 |
+
ta.save("ordtak.wav", wav, model.sr)
|
128 |
```
|
129 |
See `example_tts.py` for more examples.
|
130 |
|