Views
No views yet
handler.py — custom handler (carrega VoxCPM2, gera áudio, retorna WAV em base64).requirements.txt — dependências (voxcpm, soundfile, librosa).test_client.py — cliente de teste.seu-usuario/voxcpm2-tts-endpoint.
Não precisa subir os pesos — o handler baixa o VoxCPM2 do Hub no startup.handler.py e requirements.txt na raiz:1pip install -U huggingface_hub
2huggingface-cli login
3huggingface-cli upload seu-usuario/voxcpm2-tts-endpoint ./handler.py handler.py
4huggingface-cli upload seu-usuario/voxcpm2-tts-endpoint ./requirements.txt requirements.txtseu-usuario/voxcpm2-tts-endpointhandler.py automaticamente (custom handler).1export HF_ENDPOINT_URL="https://xxxxx.endpoints.huggingface.cloud"
2export HF_TOKEN="hf_..."
3python test_client.py "Que noticia maravilhosa, conseguimos!" "energetic young Brazilian woman"
4# -> out.wav1{
2 "inputs": "Texto em pt-BR.",
3 "parameters": {
4 "voice_instruction": "energetic young Brazilian woman",
5 "cfg_value": 2.0,
6 "inference_timesteps": 10,
7 "normalize": false,
8 "reference_audio_b64": "<wav base64 — opcional, p/ clonar voz>"
9 }
10}{ "sample_rate": 48000, "format": "wav", "duration_sec": 5.1, "audio_b64": "<wav base64>" }voice_instruction (descrição da voz/emoção, melhor em inglês).reference_audio_b64 (um wav curto) — clona o timbre e aplica o estilo do voice_instruction.torchcodec (dependência do voxcpm) pode falhar ao carregar no container, mas o VoxCPM usa librosa pra ler a referência — funciona mesmo assim.