Skip to content

Instantly share code, notes, and snippets.

@jondurbin
Last active March 18, 2025 10:37
Show Gist options
  • Save jondurbin/9f84bcd0be8f7b1be032bb1fff88dc83 to your computer and use it in GitHub Desktop.
Save jondurbin/9f84bcd0be8f7b1be032bb1fff88dc83 to your computer and use it in GitHub Desktop.
Inference example with Spark-TTS on chutes
import os
import requests
import base64
audio = base64.b64encode(open("test.wav", "rb").read()).decode()
result = requests.post(
"https://chutes-spark-tts.chutes.ai/speak",
json={
"text": "How much wood would a woodchuck chuck if a woodchuck could chuck wood?",
"sample_audio_b64": audio,
"speed": "very_low",
"pitch": "very_high",
},
headers={
"Authorization": os.environ["CHUTES_API_KEY"],
},
)
with open("new.wav", "wb") as outfile:
outfile.write(result.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment