[Bugfix] Fish Speech Gradio hardcoded default voice causes 400 error (#3941)

Signed-off-by: nagelanping <xiao.yi.ming@foxmail.com>
This commit is contained in:
Optance authored and GitHub committed 2026-06-07 15:01:25 +00:00
1 parent 923c1d9402
commit 4d71a162e6
2 files changed
+9 -4

No files matched your search

@@ -51,13 +51,18 @@ def build_payload(
response_format: str = "wav",
stream: bool = False,
) -> dict:
"""Build the /v1/audio/speech request payload."""
"""Build the /v1/audio/speech request payload.
Fish Speech has no built-in speakers; omit ``voice`` so the model
generates with a random timbre (controllable via text tags like
``[cool]``, ``[warm]``, etc.). When ``ref_audio`` is supplied we
enter voice-cloning mode instead.
"""
if not text or not text.strip():
raise gr.Error("Please enter text to synthesize.")
payload: dict = {
"input": text.strip(),
"voice": "default",
"response_format": "pcm" if stream else response_format,
"stream": stream,
}
@@ -193,7 +198,8 @@ def build_interface(api_base: str, stream_chunk_seconds: float = 0.5):
with gr.Accordion("Voice Cloning (optional)", open=False):
gr.Markdown(
"Upload or link a short reference audio (10-30s) and provide its transcript to clone the voice."
"Upload or link a short reference audio (10-30s) and provide its transcript to clone the voice. "
"Leave empty for random timbre; use text tags like `[cool]`, `[warm]`, `[happy]` to steer the output."
)
ref_audio = gr.Audio(
label="Reference Audio",
@@ -39,7 +39,6 @@ def run_tts(args) -> None:
payload = {
"model": args.model,
"input": args.text,
"voice": "default",
"response_format": args.response_format,
}