[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:
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",
|
response_format: str = "wav",
|
||||||
stream: bool = False,
|
stream: bool = False,
|
||||||
) -> dict:
|
) -> 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():
|
if not text or not text.strip():
|
||||||
raise gr.Error("Please enter text to synthesize.")
|
raise gr.Error("Please enter text to synthesize.")
|
||||||
|
|
||||||
payload: dict = {
|
payload: dict = {
|
||||||
"input": text.strip(),
|
"input": text.strip(),
|
||||||
"voice": "default",
|
|
||||||
"response_format": "pcm" if stream else response_format,
|
"response_format": "pcm" if stream else response_format,
|
||||||
"stream": stream,
|
"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):
|
with gr.Accordion("Voice Cloning (optional)", open=False):
|
||||||
gr.Markdown(
|
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(
|
ref_audio = gr.Audio(
|
||||||
label="Reference Audio",
|
label="Reference Audio",
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ def run_tts(args) -> None:
|
|||||||
payload = {
|
payload = {
|
||||||
"model": args.model,
|
"model": args.model,
|
||||||
"input": args.text,
|
"input": args.text,
|
||||||
"voice": "default",
|
|
||||||
"response_format": args.response_format,
|
"response_format": args.response_format,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user