Flute

Rhasspy logoPiper TTS

Piper TTS is a generative audio model for text-to-speech generation

Deploy Piper TTS behind an API endpoint in seconds.

Deploy model

Example usage

Piper TTS is a generative audio model for text-to-speech generation. This model can be trained on various voices to create realistic output audio. This model has very low latency and is optimized to run on a Raspberry Pi!

Input
1import base64
2import requests
3import os
4
5# Paste model id below
6model_id = ""
7baseten_api_key = os.environ["BASETEN_API_KEY"]
8
9def base64_to_wav(base64_string, output_file_path):
10  binary_data = base64.b64decode(base64_string)
11  with open(output_file_path, "wb") as wav_file:
12    wav_file.write(binary_data)
13
14text = "Listen up, people. Life's a wild ride, and sometimes you gotta grab it by the horns and steer it where you want to go. You can't just sit around waiting for things to happen – you gotta make 'em happen. Yeah, it's gonna get tough, but that's when you dig deep, find that inner badass, and come out swinging. Remember, success ain't handed to you on a silver platter; you gotta snatch it like it owes you money. So, lace up your boots, square those shoulders, and let the world know that you're here to play, and you're playing for keeps"
15data = {"text": text}
16
17res = requests.post(
18    f"https://model-{model_id}.api.baseten.co/production/predict",
19    headers={"Authorization": f"Api-Key {baseten_api_key}"},
20    json=data
21)
22res = res.json()
23
24output = base64_to_wav(res.get('output'), "piper-tts-output.wav")
25os.system("open piper-tts-output.wav")
JSON output
1{
2    "output": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAA..."
3}
Preview
00:00/00:00

Deploy any model in just a few commands

Avoid getting tangled in complex deployment processes. Deploy best-in-class open-source models and take advantage of optimized serving for your own models.

$

truss init -- example stable-diffusion-2-1-base ./my-sd-truss

$

cd ./my-sd-truss

$

export BASETEN_API_KEY=MdNmOCXc.YBtEZD0WFOYKso2A6NEQkRqTe

$

truss push

INFO

Serializing Stable Diffusion 2.1 truss.

INFO

Making contact with Baseten 👋 👽

INFO

🚀 Uploading model to Baseten 🚀

Upload progress: 0% | | 0.00G/2.39G