Add MaryTTS-compatible /voices endpoint
This commit is contained in:
parent
61c2aa5ac2
commit
560857c90e
2 changed files with 25 additions and 2 deletions
|
|
@ -269,7 +269,7 @@ def get_app(args: argparse.Namespace, request_queue: Queue, temp_dir: str):
|
||||||
return jsonify(voice_dicts)
|
return jsonify(voice_dicts)
|
||||||
|
|
||||||
@app.route("/process", methods=["GET", "POST"])
|
@app.route("/process", methods=["GET", "POST"])
|
||||||
async def api_process():
|
async def api_marytts_process():
|
||||||
"""MaryTTS-compatible /process endpoint"""
|
"""MaryTTS-compatible /process endpoint"""
|
||||||
voice = args.voice
|
voice = args.voice
|
||||||
|
|
||||||
|
|
@ -305,6 +305,29 @@ def get_app(args: argparse.Namespace, request_queue: Queue, temp_dir: str):
|
||||||
|
|
||||||
return Response(wav_bytes, mimetype="audio/wav")
|
return Response(wav_bytes, mimetype="audio/wav")
|
||||||
|
|
||||||
|
@app.route("/voices", methods=["GET"])
|
||||||
|
async def api_marytts_voices():
|
||||||
|
"""MaryTTS-compatible /voices endpoint"""
|
||||||
|
voices_by_key = {v.key: v for v in _MIMIC3.get_voices()}
|
||||||
|
sorted_voices = sorted(voices_by_key.values(), key=lambda v: v.key)
|
||||||
|
|
||||||
|
# [voice] [language] [gender] [tech=hmm]
|
||||||
|
lines = []
|
||||||
|
gender = "NA" # don't have this information for every speaker yet
|
||||||
|
tech = "vits"
|
||||||
|
|
||||||
|
for voice in sorted_voices:
|
||||||
|
if voice.is_multispeaker:
|
||||||
|
# List each speaker separately
|
||||||
|
for speaker in voice.speakers:
|
||||||
|
lines.append(
|
||||||
|
f"{voice.key}#{speaker} {voice.language} {gender} {tech}"
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
lines.append(f"{voice.key} {voice.language} {gender} {tech}")
|
||||||
|
|
||||||
|
return "\n".join(lines)
|
||||||
|
|
||||||
@app.route("/api/healthcheck", methods=["GET"])
|
@app.route("/api/healthcheck", methods=["GET"])
|
||||||
async def api_healthcheck():
|
async def api_healthcheck():
|
||||||
"""Endpoint to check health status"""
|
"""Endpoint to check health status"""
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
0.2.2
|
0.2.3
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue