Instructions to use aiplexdeveloper/chatterbox with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Chatterbox
How to use aiplexdeveloper/chatterbox with Chatterbox:
# pip install chatterbox-tts import torchaudio as ta from chatterbox.tts import ChatterboxTTS model = ChatterboxTTS.from_pretrained(device="cuda") text = "Ezreal and Jinx teamed up with Ahri, Yasuo, and Teemo to take down the enemy's Nexus in an epic late-game pentakill." wav = model.generate(text) ta.save("test-1.wav", wav, model.sr) # If you want to synthesize with a different voice, specify the audio prompt AUDIO_PROMPT_PATH="YOUR_FILE.wav" wav = model.generate(text, audio_prompt_path=AUDIO_PROMPT_PATH) ta.save("test-2.wav", wav, model.sr) - Notebooks
- Google Colab
- Kaggle
Update handler.py
Browse files- handler.py +2 -1
handler.py
CHANGED
|
@@ -32,7 +32,8 @@ class EndpointHandler:
|
|
| 32 |
# Encode to base64
|
| 33 |
audio_base64 = base64.b64encode(buffer.read()).decode('utf-8')
|
| 34 |
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
return [{"audio_base64": audio_base64, "audio_length_seconds":audio_length_seconds}]
|
|
|
|
| 32 |
# Encode to base64
|
| 33 |
audio_base64 = base64.b64encode(buffer.read()).decode('utf-8')
|
| 34 |
|
| 35 |
+
wav_squeeze = wav.squeeze() # Shape becomes [960000]
|
| 36 |
+
audio_length_seconds = len(wav_squeeze) / self.model.sr
|
| 37 |
|
| 38 |
|
| 39 |
return [{"audio_base64": audio_base64, "audio_length_seconds":audio_length_seconds}]
|