Spaces:
Running
Running
Show all Kitten TTS 2 voices again (the API now lists built-in voices as type public)
Browse filesSince about 25 Oct the KittenML API lists Kitten TTS 2's built-in voices with type "public" instead of "built_in". The demo only accepted "built_in", so its voice list came back empty and it fell back to eight hard-coded voices. It now accepts both, so all 173 voices in twenty languages show again; cloned ("custom") voices are still never offered. The four voices platform.kittenml.com stopped hiding on 22 Oct are shown too.
Tested locally: Kitten TTS 2 and 0.8 Mini generate, 173 voices listed. No new secret or setting needed.
app.py
CHANGED
|
@@ -39,8 +39,9 @@ VOICES_08 = [("Bella 路 Warm", "Bella"), ("Jasper 路 Narrator", "Jasper"), ("Lun
|
|
| 39 |
("Rosie 路 Bright", "Rosie"), ("Hugo 路 Assistant", "Hugo"), ("Kiki 路 Playful", "Kiki"), ("Leo 路 Bold", "Leo")]
|
| 40 |
DEFAULT_VOICE_08 = "Jasper"
|
| 41 |
|
| 42 |
-
# Kitten TTS 2 voices come from the API.
|
| 43 |
-
|
|
|
|
| 44 |
DEFAULT_VOICE_TTS2 = "saoirse_joyful_irish_female_07"
|
| 45 |
LANGUAGE_NAMES = {
|
| 46 |
"en": "English", "hi": "Hindi", "es": "Spanish", "fr": "French", "de": "German", "it": "Italian",
|
|
@@ -146,7 +147,7 @@ def _clean_name(name):
|
|
| 146 |
def tts2_voices(max_age=3600):
|
| 147 |
"""Every built-in Kitten TTS 2 voice the API lists, refreshed hourly.
|
| 148 |
|
| 149 |
-
Only built-in voices: the key's own cloned voices must never be offered or accepted.
|
| 150 |
"""
|
| 151 |
with _voices_lock:
|
| 152 |
if API_KEY and time.time() - _voices["at"] > max_age:
|
|
@@ -157,7 +158,7 @@ def tts2_voices(max_age=3600):
|
|
| 157 |
{"id": v["id"], "name": _clean_name(v.get("name") or v["id"]), "language": v.get("language") or "en",
|
| 158 |
"preview": bool(v.get("experimental"))}
|
| 159 |
for v in response.json().get("data", [])
|
| 160 |
-
if v.get("type")
|
| 161 |
]
|
| 162 |
if listed:
|
| 163 |
_voices["list"] = listed
|
|
|
|
| 39 |
("Rosie 路 Bright", "Rosie"), ("Hugo 路 Assistant", "Hugo"), ("Kiki 路 Playful", "Kiki"), ("Leo 路 Bold", "Leo")]
|
| 40 |
DEFAULT_VOICE_08 = "Jasper"
|
| 41 |
|
| 42 |
+
# Kitten TTS 2 voices come from the API. The built-in voices are listed with type "public" (since late October
|
| 43 |
+
# 2026; "built_in" before). "custom" voices are the key's own clones and are never offered or accepted.
|
| 44 |
+
OFFERED_VOICE_TYPES = {"public", "built_in"}
|
| 45 |
DEFAULT_VOICE_TTS2 = "saoirse_joyful_irish_female_07"
|
| 46 |
LANGUAGE_NAMES = {
|
| 47 |
"en": "English", "hi": "Hindi", "es": "Spanish", "fr": "French", "de": "German", "it": "Italian",
|
|
|
|
| 147 |
def tts2_voices(max_age=3600):
|
| 148 |
"""Every built-in Kitten TTS 2 voice the API lists, refreshed hourly.
|
| 149 |
|
| 150 |
+
Only the built-in voices: the key's own cloned voices must never be offered or accepted.
|
| 151 |
"""
|
| 152 |
with _voices_lock:
|
| 153 |
if API_KEY and time.time() - _voices["at"] > max_age:
|
|
|
|
| 158 |
{"id": v["id"], "name": _clean_name(v.get("name") or v["id"]), "language": v.get("language") or "en",
|
| 159 |
"preview": bool(v.get("experimental"))}
|
| 160 |
for v in response.json().get("data", [])
|
| 161 |
+
if v.get("type") in OFFERED_VOICE_TYPES and v.get("id")
|
| 162 |
]
|
| 163 |
if listed:
|
| 164 |
_voices["list"] = listed
|