Spaces:
Sleeping
Sleeping
schroneko commited on
Commit ·
83059c5
1
Parent(s): 3c10af3
Pass VoiceDesign caption through StackChan API
Browse files
README.md
CHANGED
|
@@ -31,6 +31,7 @@ Parameters:
|
|
| 31 |
- `duration_scale`: optional duration predictor scale. Default is `0.95`
|
| 32 |
- `steps`: diffusion steps. Default is `18`
|
| 33 |
- `seed`: optional. Leave empty for stable per-speaker seed
|
|
|
|
| 34 |
|
| 35 |
Example:
|
| 36 |
|
|
@@ -48,8 +49,10 @@ Response shape:
|
|
| 48 |
"seed": "4683784571875087395",
|
| 49 |
"durationScale": 0.95,
|
| 50 |
"metadata": {
|
|
|
|
| 51 |
"reference_used": true,
|
| 52 |
-
"reference_path": "reference/stackchan-reference.mp3"
|
|
|
|
| 53 |
},
|
| 54 |
"mp3StreamingUrl": "https://...",
|
| 55 |
"mp3DownloadUrl": "https://...",
|
|
@@ -80,6 +83,7 @@ Configuration:
|
|
| 80 |
- `DEFAULT_DURATION_SCALE`: default `0.95`
|
| 81 |
- `DEFAULT_STEPS`: default `18`
|
| 82 |
- `DEFAULT_SEED`: default `3407`
|
|
|
|
| 83 |
- `MAX_TEXT_LENGTH`: default `240`
|
| 84 |
|
| 85 |
## Cost
|
|
|
|
| 31 |
- `duration_scale`: optional duration predictor scale. Default is `0.95`
|
| 32 |
- `steps`: diffusion steps. Default is `18`
|
| 33 |
- `seed`: optional. Leave empty for stable per-speaker seed
|
| 34 |
+
- `caption`: optional VoiceDesign prompt. Defaults to the StackChan voice style
|
| 35 |
|
| 36 |
Example:
|
| 37 |
|
|
|
|
| 49 |
"seed": "4683784571875087395",
|
| 50 |
"durationScale": 0.95,
|
| 51 |
"metadata": {
|
| 52 |
+
"checkpoint_repo": "Aratako/Irodori-TTS-600M-v3-VoiceDesign",
|
| 53 |
"reference_used": true,
|
| 54 |
+
"reference_path": "reference/stackchan-reference.mp3",
|
| 55 |
+
"caption_used": true
|
| 56 |
},
|
| 57 |
"mp3StreamingUrl": "https://...",
|
| 58 |
"mp3DownloadUrl": "https://...",
|
|
|
|
| 83 |
- `DEFAULT_DURATION_SCALE`: default `0.95`
|
| 84 |
- `DEFAULT_STEPS`: default `18`
|
| 85 |
- `DEFAULT_SEED`: default `3407`
|
| 86 |
+
- `DEFAULT_CAPTION`: default StackChan VoiceDesign prompt
|
| 87 |
- `MAX_TEXT_LENGTH`: default `240`
|
| 88 |
|
| 89 |
## Cost
|
app.py
CHANGED
|
@@ -22,6 +22,10 @@ DEFAULT_SECONDS = "" if DEFAULT_SECONDS_RAW.lower() in {"", "auto", "none"} else
|
|
| 22 |
DEFAULT_DURATION_SCALE = float(os.getenv("DEFAULT_DURATION_SCALE", "0.95"))
|
| 23 |
DEFAULT_STEPS = int(os.getenv("DEFAULT_STEPS", "18"))
|
| 24 |
DEFAULT_SEED = int(os.getenv("DEFAULT_SEED", "3407"))
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
OUTPUT_DIR = Path(os.getenv("OUTPUT_DIR", "/tmp/stackchan-audio"))
|
| 27 |
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
|
@@ -113,6 +117,7 @@ def synthesis(
|
|
| 113 |
duration_scale: float = Query(default=DEFAULT_DURATION_SCALE, gt=0.0, le=2.0),
|
| 114 |
steps: int = Query(default=DEFAULT_STEPS, ge=1, le=80),
|
| 115 |
seed: str = Query(default=""),
|
|
|
|
| 116 |
) -> JSONResponse:
|
| 117 |
_check_key(key)
|
| 118 |
text = text.strip()
|
|
@@ -130,6 +135,7 @@ def synthesis(
|
|
| 130 |
duration_scale=float(duration_scale),
|
| 131 |
steps=int(steps),
|
| 132 |
seed=seed_value,
|
|
|
|
| 133 |
api_name="/synthesize",
|
| 134 |
)
|
| 135 |
metadata = _result_metadata(result)
|
|
|
|
| 22 |
DEFAULT_DURATION_SCALE = float(os.getenv("DEFAULT_DURATION_SCALE", "0.95"))
|
| 23 |
DEFAULT_STEPS = int(os.getenv("DEFAULT_STEPS", "18"))
|
| 24 |
DEFAULT_SEED = int(os.getenv("DEFAULT_SEED", "3407"))
|
| 25 |
+
DEFAULT_CAPTION = os.getenv(
|
| 26 |
+
"DEFAULT_CAPTION",
|
| 27 |
+
"若く元気な女性の声。近い距離感で、明るくやわらかく自然に話している。",
|
| 28 |
+
)
|
| 29 |
|
| 30 |
OUTPUT_DIR = Path(os.getenv("OUTPUT_DIR", "/tmp/stackchan-audio"))
|
| 31 |
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
| 117 |
duration_scale: float = Query(default=DEFAULT_DURATION_SCALE, gt=0.0, le=2.0),
|
| 118 |
steps: int = Query(default=DEFAULT_STEPS, ge=1, le=80),
|
| 119 |
seed: str = Query(default=""),
|
| 120 |
+
caption: str = Query(default=DEFAULT_CAPTION),
|
| 121 |
) -> JSONResponse:
|
| 122 |
_check_key(key)
|
| 123 |
text = text.strip()
|
|
|
|
| 135 |
duration_scale=float(duration_scale),
|
| 136 |
steps=int(steps),
|
| 137 |
seed=seed_value,
|
| 138 |
+
caption=str(caption).strip() or DEFAULT_CAPTION,
|
| 139 |
api_name="/synthesize",
|
| 140 |
)
|
| 141 |
metadata = _result_metadata(result)
|