bupalinyu commited on
Commit
0a10d51
·
verified ·
1 Parent(s): f3ae446

Deploy Audio8 TTS Preview with official adapter

Browse files
.dockerignore ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ .git
2
+ .DS_Store
3
+ .venv
4
+ .uv-cache
5
+ **/__pycache__
6
+ **/*.pyc
7
+ **/.pytest_cache
8
+ outputs
9
+ *.wav
10
+ !examples/*.wav
.gitattributes CHANGED
@@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ examples/en_female_clara.wav filter=lfs diff=lfs merge=lfs -text
37
+ examples/en_female_iris.wav filter=lfs diff=lfs merge=lfs -text
38
+ examples/en_male_arthur.wav filter=lfs diff=lfs merge=lfs -text
39
+ examples/zh_en_female_sophie.wav filter=lfs diff=lfs merge=lfs -text
40
+ examples/zh_female_mia.wav filter=lfs diff=lfs merge=lfs -text
41
+ examples/zh_male_ben.wav filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ .venv/
3
+ .uv-cache/
4
+ **/__pycache__/
5
+ **/*.pyc
6
+ outputs/
Dockerfile ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM lmsysorg/sglang:v0.5.8-cu129-amd64-runtime@sha256:85feb856fb76c986cc31001b438d9d243c805378a9e63254fdaaf6cb1740d332
2
+
3
+ USER root
4
+
5
+ RUN apt-get update && \
6
+ apt-get install -y --no-install-recommends curl git libsndfile1 && \
7
+ rm -rf /var/lib/apt/lists/* && \
8
+ mkdir -p /home/user/app /models /opt/sglang-omni /opt/audio8-tts /tmp/audio8-flashinfer && \
9
+ chown -R 1000:1000 /home/user /models /tmp/audio8-flashinfer
10
+
11
+ WORKDIR /home/user/app
12
+
13
+ ARG SGLANG_OMNI_REVISION=68a572348837f7b004857b4b07993c20ade4c017
14
+ ARG AUDIO8_TTS_REVISION=2b2946e7f046bce0a840c7bb3e6e40687eff3f5b
15
+
16
+ RUN git init /opt/sglang-omni && \
17
+ git -C /opt/sglang-omni remote add origin https://github.com/sgl-project/sglang-omni.git && \
18
+ git -C /opt/sglang-omni fetch --depth 1 origin "${SGLANG_OMNI_REVISION}" && \
19
+ git -C /opt/sglang-omni checkout --detach FETCH_HEAD && \
20
+ git init /opt/audio8-tts && \
21
+ git -C /opt/audio8-tts remote add origin https://github.com/Audio8-AI/Audio8_TTS.git && \
22
+ git -C /opt/audio8-tts fetch --depth 1 origin "${AUDIO8_TTS_REVISION}" && \
23
+ git -C /opt/audio8-tts checkout --detach FETCH_HEAD && \
24
+ rm -rf /opt/sglang-omni/.git /opt/audio8-tts/.git
25
+
26
+ RUN pip install --no-cache-dir \
27
+ "accelerate==1.14.0" \
28
+ "av==17.1.0" \
29
+ "fastapi==0.139.0" \
30
+ "huggingface-hub==0.36.2" \
31
+ "httpx==0.28.1" \
32
+ "librosa==0.11.0" \
33
+ "msgpack==1.2.1" \
34
+ "numba==0.63.1" \
35
+ "python-multipart==0.0.32" \
36
+ "qwen-vl-utils==0.0.11" \
37
+ "soundfile==0.13.1" \
38
+ "transformers==4.57.1" \
39
+ "typer==0.26.8" \
40
+ "uvicorn==0.49.0" \
41
+ "xxhash==3.8.0" \
42
+ "pyzmq==27.1.0"
43
+
44
+ ENV PYTHONPATH=/opt/sglang-omni
45
+
46
+ RUN /opt/audio8-tts/sglang_omni/scripts/install_adapter.sh /opt/sglang-omni && \
47
+ python3 /opt/audio8-tts/sglang_omni/scripts/verify_install.py
48
+
49
+ COPY --chown=1000:1000 app.py ./app.py
50
+ COPY --chown=1000:1000 static ./static
51
+ COPY --chown=1000:1000 examples ./examples
52
+ COPY --chown=1000:1000 assets ./assets
53
+ COPY --chown=1000:1000 scripts ./scripts
54
+
55
+ RUN chmod +x ./scripts/*.sh
56
+
57
+ USER 1000
58
+
59
+ ARG MODEL_REPO=Audio8/Audio8-TTS-Preview-0.6b
60
+ ARG MODEL_REVISION=1b17c91db5f4dccb6914aa4aa5cb0e56661a6c17
61
+ RUN python3 -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='${MODEL_REPO}', revision='${MODEL_REVISION}', local_dir='/models/audio8-tts-0.6b')" && \
62
+ python3 /opt/audio8-tts/sglang_omni/scripts/verify_install.py --model-path /models/audio8-tts-0.6b
63
+
64
+ ENV HOME=/home/user \
65
+ HF_HOME=/home/user/.cache/huggingface \
66
+ MODEL_PATH=/models/audio8-tts-0.6b \
67
+ PORT=7860 \
68
+ BACKEND_HOST=127.0.0.1 \
69
+ BACKEND_PORT=8010 \
70
+ AUDIO8_TTS_MEM_FRACTION_STATIC=0.60 \
71
+ AUDIO8_TTS_MAX_RUNNING_REQUESTS=8 \
72
+ AUDIO8_TTS_DISABLE_CUDA_GRAPH=1 \
73
+ AUDIO8_TTS_VERIFY_FAST_KV=1 \
74
+ FLASHINFER_WORKSPACE_BASE=/tmp/audio8-flashinfer \
75
+ PYTHONUNBUFFERED=1
76
+
77
+ EXPOSE 7860
78
+
79
+ CMD ["/home/user/app/scripts/start.sh"]
README.md CHANGED
@@ -1,10 +1,41 @@
1
  ---
2
- title: Audio8 TTS Preview 0.6b
3
- emoji: 🦀
4
- colorFrom: blue
5
- colorTo: indigo
6
  sdk: docker
7
- pinned: false
 
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Audio8 TTS Preview 0.6B
3
+ colorFrom: red
4
+ colorTo: gray
 
5
  sdk: docker
6
+ app_port: 7860
7
+ models:
8
+ - Audio8/Audio8-TTS-Preview-0.6b
9
+ license: apache-2.0
10
  ---
11
 
12
+ # Audio8 TTS Preview 0.6B
13
+
14
+ Multilingual text-to-speech and zero-shot voice cloning for
15
+ [`Audio8/Audio8-TTS-Preview-0.6b`](https://huggingface.co/Audio8/Audio8-TTS-Preview-0.6b).
16
+ The service uses the official Audio8 adapter with SGLang Omni 0.1.0 and
17
+ SGLang 0.5.8.
18
+
19
+ ## API
20
+
21
+ ```bash
22
+ curl -sS \
23
+ -H 'Content-Type: application/json' \
24
+ -d '{
25
+ "model": "audio8/tts-0.6b",
26
+ "input": "Audio8 generates this sentence with the reference voice.",
27
+ "response_format": "wav",
28
+ "temperature": 0.8,
29
+ "top_p": 0.95,
30
+ "top_k": 50,
31
+ "references": [{
32
+ "audio_path": "https://example.com/reference.wav",
33
+ "text": "The exact transcript spoken in the reference audio."
34
+ }]
35
+ }' \
36
+ https://audio8-audio8-tts-preview-0-6b.hf.space/v1/audio/speech \
37
+ -o audio8-clone.wav
38
+ ```
39
+
40
+ Use reference voices only with the speaker's permission and disclose synthetic
41
+ audio where appropriate.
app.py ADDED
@@ -0,0 +1,301 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import asyncio
4
+ import os
5
+ import tempfile
6
+ import time
7
+ from pathlib import Path
8
+ from typing import Annotated
9
+
10
+ import httpx
11
+ from fastapi import FastAPI, File, Form, HTTPException, Request, UploadFile
12
+ from fastapi.middleware.cors import CORSMiddleware
13
+ from fastapi.responses import FileResponse, JSONResponse, Response
14
+ from fastapi.staticfiles import StaticFiles
15
+
16
+
17
+ ROOT = Path(__file__).resolve().parent
18
+ BACKEND_URL = os.getenv("BACKEND_URL", "http://127.0.0.1:8010")
19
+ MAX_UPLOAD_BYTES = 15 * 1024 * 1024
20
+ ALLOWED_AUDIO_SUFFIXES = {".wav", ".mp3", ".flac", ".m4a", ".ogg"}
21
+ GENERATION_LIMIT = asyncio.Semaphore(int(os.getenv("UI_MAX_CONCURRENCY", "4")))
22
+
23
+ ENGLISH_REFERENCE_TEXT = (
24
+ "hello nice to meet you, what would you like to talk about todat"
25
+ )
26
+ CHINESE_REFERENCE_TEXT = "你好,我是小周,很高兴认识你"
27
+
28
+ EXAMPLES = {
29
+ "clara": {
30
+ "id": "clara",
31
+ "name": "Clara",
32
+ "locale": "English",
33
+ "tone": "Female",
34
+ "file": "en_female_clara.wav",
35
+ "transcript": ENGLISH_REFERENCE_TEXT,
36
+ },
37
+ "iris": {
38
+ "id": "iris",
39
+ "name": "Iris",
40
+ "locale": "English",
41
+ "tone": "Female",
42
+ "file": "en_female_iris.wav",
43
+ "transcript": ENGLISH_REFERENCE_TEXT,
44
+ },
45
+ "arthur": {
46
+ "id": "arthur",
47
+ "name": "Arthur",
48
+ "locale": "English",
49
+ "tone": "Male",
50
+ "file": "en_male_arthur.wav",
51
+ "transcript": ENGLISH_REFERENCE_TEXT,
52
+ },
53
+ "mia": {
54
+ "id": "mia",
55
+ "name": "Mia",
56
+ "locale": "中文",
57
+ "tone": "女声",
58
+ "file": "zh_female_mia.wav",
59
+ "transcript": CHINESE_REFERENCE_TEXT,
60
+ },
61
+ "ben": {
62
+ "id": "ben",
63
+ "name": "Ben",
64
+ "locale": "中文",
65
+ "tone": "男声",
66
+ "file": "zh_male_ben.wav",
67
+ "transcript": CHINESE_REFERENCE_TEXT,
68
+ },
69
+ "sophie": {
70
+ "id": "sophie",
71
+ "name": "Sophie",
72
+ "locale": "中英双语",
73
+ "tone": "女声",
74
+ "file": "zh_en_female_sophie.wav",
75
+ "transcript": CHINESE_REFERENCE_TEXT,
76
+ },
77
+ }
78
+
79
+ app = FastAPI(title="Audio8 TTS Preview 0.6B", version="1.0.0")
80
+ app.add_middleware(
81
+ CORSMiddleware,
82
+ allow_origins=["*"],
83
+ allow_methods=["*"],
84
+ allow_headers=["*"],
85
+ )
86
+ app.mount("/static", StaticFiles(directory=ROOT / "static"), name="static")
87
+
88
+
89
+ @app.get("/assets/{asset_name}", include_in_schema=False)
90
+ async def asset(asset_name: str) -> FileResponse:
91
+ if asset_name != "audio8-logo.jpeg":
92
+ raise HTTPException(status_code=404, detail="Asset not found")
93
+ return FileResponse(
94
+ ROOT / "assets" / asset_name,
95
+ media_type="image/jpeg",
96
+ headers={"Cache-Control": "public, max-age=86400"},
97
+ )
98
+
99
+
100
+ async def _backend_status() -> tuple[bool, dict]:
101
+ try:
102
+ async with httpx.AsyncClient(timeout=3.0) as client:
103
+ response = await client.get(f"{BACKEND_URL}/health")
104
+ payload = response.json()
105
+ return response.status_code == 200, payload
106
+ except (httpx.HTTPError, ValueError):
107
+ return False, {}
108
+
109
+
110
+ async def _generate(payload: dict) -> httpx.Response:
111
+ async with GENERATION_LIMIT:
112
+ async with httpx.AsyncClient(timeout=httpx.Timeout(600.0)) as client:
113
+ return await client.post(f"{BACKEND_URL}/v1/audio/speech", json=payload)
114
+
115
+
116
+ async def _store_upload(upload: UploadFile) -> Path:
117
+ suffix = Path(upload.filename or "reference.wav").suffix.lower()
118
+ if suffix not in ALLOWED_AUDIO_SUFFIXES:
119
+ raise HTTPException(status_code=400, detail="Unsupported reference audio format")
120
+
121
+ descriptor, raw_path = tempfile.mkstemp(prefix="audio8-reference-", suffix=suffix)
122
+ path = Path(raw_path)
123
+ total = 0
124
+ try:
125
+ with os.fdopen(descriptor, "wb") as output:
126
+ while chunk := await upload.read(1024 * 1024):
127
+ total += len(chunk)
128
+ if total > MAX_UPLOAD_BYTES:
129
+ raise HTTPException(
130
+ status_code=413,
131
+ detail="Reference audio must be 15 MB or smaller",
132
+ )
133
+ output.write(chunk)
134
+ return path
135
+ except Exception:
136
+ path.unlink(missing_ok=True)
137
+ raise
138
+ finally:
139
+ await upload.close()
140
+
141
+
142
+ @app.get("/", include_in_schema=False)
143
+ async def index() -> FileResponse:
144
+ return FileResponse(ROOT / "static" / "index.html")
145
+
146
+
147
+ @app.get("/api/examples")
148
+ async def list_examples() -> list[dict]:
149
+ return [
150
+ {
151
+ **example,
152
+ "audio_url": f"/examples/{example['id']}",
153
+ }
154
+ for example in EXAMPLES.values()
155
+ ]
156
+
157
+
158
+ @app.get("/examples/{example_id}", include_in_schema=False)
159
+ async def example_audio(example_id: str) -> FileResponse:
160
+ example = EXAMPLES.get(example_id)
161
+ if example is None:
162
+ raise HTTPException(status_code=404, detail="Voice example not found")
163
+ return FileResponse(
164
+ ROOT / "examples" / example["file"],
165
+ media_type="audio/wav",
166
+ headers={"Cache-Control": "public, max-age=86400"},
167
+ )
168
+
169
+
170
+ @app.get("/api/status")
171
+ async def api_status() -> dict:
172
+ ready, details = await _backend_status()
173
+ return {
174
+ "state": "ready" if ready else "warming",
175
+ "model": "Audio8/Audio8-TTS-Preview-0.6b",
176
+ "engine": "SGLang-Omni 0.1.0 / SGLang 0.5.8",
177
+ "details": details,
178
+ }
179
+
180
+
181
+ @app.post("/api/generate")
182
+ async def generate_speech(
183
+ text: Annotated[str, Form()],
184
+ reference_text: Annotated[str, Form()],
185
+ example_id: Annotated[str | None, Form()] = None,
186
+ reference_audio: Annotated[UploadFile | None, File()] = None,
187
+ temperature: Annotated[float, Form()] = 0.8,
188
+ top_p: Annotated[float, Form()] = 0.95,
189
+ top_k: Annotated[int, Form()] = 50,
190
+ max_new_tokens: Annotated[int, Form()] = 1024,
191
+ ) -> Response:
192
+ text = " ".join(text.split())
193
+ reference_text = " ".join(reference_text.split())
194
+ if not text:
195
+ raise HTTPException(status_code=400, detail="Text must not be empty")
196
+ if len(text) > 1000:
197
+ raise HTTPException(status_code=400, detail="Text must be 1000 characters or fewer")
198
+ if not reference_text:
199
+ raise HTTPException(status_code=400, detail="Reference transcript is required")
200
+ if not 0 <= temperature <= 2:
201
+ raise HTTPException(status_code=400, detail="Temperature must be between 0 and 2")
202
+ if not 0 < top_p <= 1:
203
+ raise HTTPException(status_code=400, detail="Top P must be between 0 and 1")
204
+ if not 1 <= top_k <= 200:
205
+ raise HTTPException(status_code=400, detail="Top K must be between 1 and 200")
206
+ if not 32 <= max_new_tokens <= 2048:
207
+ raise HTTPException(status_code=400, detail="Max tokens must be between 32 and 2048")
208
+
209
+ temporary_path: Path | None = None
210
+ if reference_audio is not None and reference_audio.filename:
211
+ temporary_path = await _store_upload(reference_audio)
212
+ reference_path = temporary_path
213
+ elif example_id and example_id in EXAMPLES:
214
+ reference_path = ROOT / "examples" / EXAMPLES[example_id]["file"]
215
+ else:
216
+ raise HTTPException(status_code=400, detail="Select or upload a reference voice")
217
+
218
+ payload = {
219
+ "model": "audio8/tts-0.6b",
220
+ "input": text,
221
+ "response_format": "wav",
222
+ "max_new_tokens": max_new_tokens,
223
+ "temperature": temperature,
224
+ "top_p": top_p,
225
+ "top_k": top_k,
226
+ "references": [
227
+ {
228
+ "audio_path": str(reference_path),
229
+ "text": reference_text,
230
+ }
231
+ ],
232
+ }
233
+
234
+ started = time.perf_counter()
235
+ try:
236
+ response = await _generate(payload)
237
+ except httpx.ConnectError as exc:
238
+ raise HTTPException(status_code=503, detail="Model is still warming up") from exc
239
+ except httpx.TimeoutException as exc:
240
+ raise HTTPException(status_code=504, detail="Generation timed out") from exc
241
+ finally:
242
+ if temporary_path is not None:
243
+ temporary_path.unlink(missing_ok=True)
244
+
245
+ if response.status_code != 200:
246
+ try:
247
+ detail = response.json().get("detail", response.text)
248
+ except ValueError:
249
+ detail = response.text
250
+ raise HTTPException(status_code=response.status_code, detail=detail)
251
+
252
+ headers = {
253
+ "Content-Disposition": 'attachment; filename="audio8-clone.wav"',
254
+ "X-Generation-Duration-Ms": str(round((time.perf_counter() - started) * 1000)),
255
+ }
256
+ for name in ("x-prompt-tokens", "x-completion-tokens", "x-engine-time"):
257
+ if name in response.headers:
258
+ headers[name] = response.headers[name]
259
+ return Response(content=response.content, media_type="audio/wav", headers=headers)
260
+
261
+
262
+ @app.get("/health")
263
+ async def health() -> JSONResponse:
264
+ ready, details = await _backend_status()
265
+ return JSONResponse(
266
+ status_code=200 if ready else 503,
267
+ content={"status": "healthy" if ready else "warming", **details},
268
+ )
269
+
270
+
271
+ @app.get("/v1/models")
272
+ async def models_proxy() -> Response:
273
+ async with httpx.AsyncClient(timeout=10.0) as client:
274
+ response = await client.get(f"{BACKEND_URL}/v1/models")
275
+ return Response(
276
+ content=response.content,
277
+ status_code=response.status_code,
278
+ media_type=response.headers.get("content-type", "application/json"),
279
+ )
280
+
281
+
282
+ @app.post("/v1/audio/speech")
283
+ async def speech_proxy(request: Request) -> Response:
284
+ body = await request.body()
285
+ async with httpx.AsyncClient(timeout=httpx.Timeout(600.0)) as client:
286
+ response = await client.post(
287
+ f"{BACKEND_URL}/v1/audio/speech",
288
+ content=body,
289
+ headers={"Content-Type": request.headers.get("content-type", "application/json")},
290
+ )
291
+ forwarded_headers = {
292
+ name: value
293
+ for name, value in response.headers.items()
294
+ if name.lower().startswith("x-") or name.lower() == "content-disposition"
295
+ }
296
+ return Response(
297
+ content=response.content,
298
+ status_code=response.status_code,
299
+ media_type=response.headers.get("content-type", "application/octet-stream"),
300
+ headers=forwarded_headers,
301
+ )
assets/audio8-logo.jpeg ADDED
examples/en_female_clara.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b800383f2b92b6660ba32a5751faedfe4c6d2c889b5836a8e3f97e1fbc7b15dc
3
+ size 331854
examples/en_female_iris.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a6ea95ebc3d550724cae89bd4c6d9a33b2c1c9533ca5a542b8756bb31f2e6bc
3
+ size 344142
examples/en_male_arthur.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e52a09743564884880568d7b006b0162a278f12ecef7b1245fc41288805f9745
3
+ size 352334
examples/zh_en_female_sophie.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62957ba17ed84c4b8417aa56848b2dca0726bbe42e6fa5ab937a0c9de0697059
3
+ size 262222
examples/zh_female_mia.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb16d6c65ed49d9a6fe1c9266bec8683a712f66fac7abafac298fa2c5ce12477
3
+ size 286798
examples/zh_male_ben.wav ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62108e35015fd40be5ea54d1c8e77774837f4c472dc3d085fb38c15d8b42b4ce
3
+ size 245838
scripts/run_backend.sh ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ MODEL_PATH="${MODEL_PATH:-/models/audio8-tts-0.6b}"
5
+ ADAPTER_ROOT="${AUDIO8_TTS_ROOT:-/opt/audio8-tts}"
6
+
7
+ export SGLANG_OMNI_ROOT="${SGLANG_OMNI_ROOT:-/opt/sglang-omni}"
8
+ export PYTHONPATH="${SGLANG_OMNI_ROOT}${PYTHONPATH:+:${PYTHONPATH}}"
9
+ export FLASHINFER_WORKSPACE_BASE="${FLASHINFER_WORKSPACE_BASE:-/tmp/audio8-flashinfer}"
10
+
11
+ if [[ "${AUDIO8_TTS_VERIFY_FAST_KV:-0}" == "1" ]]; then
12
+ python3 "${ADAPTER_ROOT}/sglang_omni/scripts/test_fast_kv_cache.py" \
13
+ --model-path "${MODEL_PATH}" \
14
+ --batch-size "${AUDIO8_TTS_FAST_KV_TEST_BATCH_SIZE:-2}"
15
+ fi
16
+
17
+ export MODEL="${MODEL_PATH}"
18
+ export CONFIG="${PIPELINE_CONFIG:-${ADAPTER_ROOT}/sglang_omni/configs/audio8_tts_0_6b.yaml}"
19
+ export MODEL_NAME="${MODEL_NAME:-audio8/tts-0.6b}"
20
+ export HOST="${BACKEND_HOST:-127.0.0.1}"
21
+ export PORT="${BACKEND_PORT:-8010}"
22
+
23
+ exec "${ADAPTER_ROOT}/sglang_omni/scripts/run_server.sh"
scripts/start.sh ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ /home/user/app/scripts/run_backend.sh &
5
+ backend_pid=$!
6
+
7
+ cleanup() {
8
+ kill "${backend_pid}" 2>/dev/null || true
9
+ }
10
+ trap cleanup EXIT INT TERM
11
+
12
+ # Expose the UI immediately while the model initializes in the background.
13
+ exec uvicorn app:app --host 0.0.0.0 --port "${PORT:-7860}" --workers 1
static/app.js ADDED
@@ -0,0 +1,323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const state = {
2
+ examples: [],
3
+ selectedExample: null,
4
+ source: "library",
5
+ activePreview: null,
6
+ resultUrl: null,
7
+ uploadUrl: null,
8
+ };
9
+
10
+ const textPresets = {
11
+ zh: "今天想和你分享一个好消息,Audio8 现在可以用更高效的方式生成自然流畅的语音。",
12
+ en: "Every voice carries a story. With Audio8, that story can travel across languages and reach more people.",
13
+ ja: "今日は穏やかな一日ですね。新しい音声技術について、ゆっくりお話ししましょう。",
14
+ es: "Cada voz tiene una historia, y hoy podemos compartirla de una forma más natural y cercana.",
15
+ };
16
+
17
+ const elements = {
18
+ form: document.querySelector("#generationForm"),
19
+ voiceLibrary: document.querySelector("#voiceLibrary"),
20
+ uploadPanel: document.querySelector("#uploadPanel"),
21
+ referenceAudio: document.querySelector("#referenceAudio"),
22
+ referenceText: document.querySelector("#referenceText"),
23
+ uploadTitle: document.querySelector("#uploadTitle"),
24
+ uploadPreview: document.querySelector("#uploadPreview"),
25
+ speechText: document.querySelector("#speechText"),
26
+ characterCount: document.querySelector("#characterCount"),
27
+ consent: document.querySelector("#consent"),
28
+ generateButton: document.querySelector("#generateButton"),
29
+ runtimeStatus: document.querySelector("#runtimeStatus"),
30
+ runtimeLabel: document.querySelector("#runtimeLabel"),
31
+ emptyOutput: document.querySelector("#emptyOutput"),
32
+ loadingOutput: document.querySelector("#loadingOutput"),
33
+ loadingTitle: document.querySelector("#loadingTitle"),
34
+ elapsedTime: document.querySelector("#elapsedTime"),
35
+ resultOutput: document.querySelector("#resultOutput"),
36
+ resultBadge: document.querySelector("#resultBadge"),
37
+ resultAudio: document.querySelector("#resultAudio"),
38
+ resultWaveform: document.querySelector("#resultWaveform"),
39
+ generationTime: document.querySelector("#generationTime"),
40
+ audioDuration: document.querySelector("#audioDuration"),
41
+ downloadButton: document.querySelector("#downloadButton"),
42
+ errorOutput: document.querySelector("#errorOutput"),
43
+ errorMessage: document.querySelector("#errorMessage"),
44
+ };
45
+
46
+ function refreshIcons() {
47
+ if (window.lucide) {
48
+ window.lucide.createIcons({ attrs: { "stroke-width": 1.8 } });
49
+ }
50
+ }
51
+
52
+ function formatDuration(seconds) {
53
+ if (!Number.isFinite(seconds)) return "--";
54
+ return seconds < 60 ? `${seconds.toFixed(1)}s` : `${Math.floor(seconds / 60)}m ${Math.round(seconds % 60)}s`;
55
+ }
56
+
57
+ async function drawWaveform(url, canvas, color = "#8a8780") {
58
+ const response = await fetch(url);
59
+ if (!response.ok) return;
60
+ const data = await response.arrayBuffer();
61
+ const context = new AudioContext();
62
+ try {
63
+ const buffer = await context.decodeAudioData(data.slice(0));
64
+ const samples = buffer.getChannelData(0);
65
+ const width = canvas.width;
66
+ const height = canvas.height;
67
+ const blocks = Math.min(120, Math.max(36, Math.floor(width / 8)));
68
+ const blockSize = Math.max(1, Math.floor(samples.length / blocks));
69
+ const peaks = [];
70
+ for (let block = 0; block < blocks; block += 1) {
71
+ let peak = 0;
72
+ const start = block * blockSize;
73
+ const end = Math.min(samples.length, start + blockSize);
74
+ for (let index = start; index < end; index += 1) {
75
+ peak = Math.max(peak, Math.abs(samples[index]));
76
+ }
77
+ peaks.push(peak);
78
+ }
79
+ const maxPeak = Math.max(...peaks, 0.001);
80
+ const draw = canvas.getContext("2d");
81
+ draw.clearRect(0, 0, width, height);
82
+ draw.fillStyle = color;
83
+ const barWidth = Math.max(2, width / blocks - 3);
84
+ peaks.forEach((peak, index) => {
85
+ const normalized = peak / maxPeak;
86
+ const barHeight = Math.max(3, normalized * height * 0.86);
87
+ const x = index * (width / blocks) + 1;
88
+ draw.fillRect(x, (height - barHeight) / 2, barWidth, barHeight);
89
+ });
90
+ } finally {
91
+ await context.close();
92
+ }
93
+ }
94
+
95
+ function stopPreview() {
96
+ if (!state.activePreview) return;
97
+ state.activePreview.audio.pause();
98
+ state.activePreview.audio.currentTime = 0;
99
+ state.activePreview.button.innerHTML = '<i data-lucide="play" aria-hidden="true"></i>';
100
+ state.activePreview.button.setAttribute("aria-label", "Play voice sample");
101
+ state.activePreview = null;
102
+ refreshIcons();
103
+ }
104
+
105
+ function selectExample(example) {
106
+ state.selectedExample = example;
107
+ elements.referenceText.value = example.transcript;
108
+ document.querySelectorAll(".voice-option").forEach((option) => {
109
+ const selected = option.dataset.exampleId === example.id;
110
+ option.classList.toggle("selected", selected);
111
+ option.setAttribute("aria-checked", String(selected));
112
+ });
113
+ }
114
+
115
+ function createVoiceOption(example, index) {
116
+ const option = document.createElement("div");
117
+ option.className = "voice-option";
118
+ option.dataset.exampleId = example.id;
119
+ option.setAttribute("role", "radio");
120
+ option.setAttribute("aria-checked", "false");
121
+ option.tabIndex = 0;
122
+
123
+ const play = document.createElement("button");
124
+ play.type = "button";
125
+ play.className = "voice-play";
126
+ play.setAttribute("aria-label", `Play ${example.name} voice sample`);
127
+ play.innerHTML = '<i data-lucide="play" aria-hidden="true"></i>';
128
+
129
+ const meta = document.createElement("div");
130
+ meta.className = "voice-meta";
131
+ meta.innerHTML = `<strong>${example.name}</strong><span>${example.locale} / ${example.tone}</span>`;
132
+
133
+ const canvas = document.createElement("canvas");
134
+ canvas.width = 360;
135
+ canvas.height = 56;
136
+ canvas.setAttribute("aria-hidden", "true");
137
+
138
+ option.append(play, meta, canvas);
139
+ option.addEventListener("click", () => selectExample(example));
140
+ option.addEventListener("keydown", (event) => {
141
+ if (event.key === "Enter" || event.key === " ") {
142
+ event.preventDefault();
143
+ selectExample(example);
144
+ }
145
+ });
146
+
147
+ const audio = new Audio(example.audio_url);
148
+ play.addEventListener("click", (event) => {
149
+ event.stopPropagation();
150
+ if (state.activePreview?.audio === audio && !audio.paused) {
151
+ stopPreview();
152
+ return;
153
+ }
154
+ stopPreview();
155
+ selectExample(example);
156
+ audio.play();
157
+ play.innerHTML = '<i data-lucide="square" aria-hidden="true"></i>';
158
+ play.setAttribute("aria-label", `Stop ${example.name} voice sample`);
159
+ state.activePreview = { audio, button: play };
160
+ refreshIcons();
161
+ });
162
+ audio.addEventListener("ended", stopPreview);
163
+
164
+ drawWaveform(example.audio_url, canvas, index === 0 ? "#e64b2f" : "#8a8780").catch(() => {});
165
+ return option;
166
+ }
167
+
168
+ async function loadExamples() {
169
+ const response = await fetch("/api/examples");
170
+ if (!response.ok) throw new Error("Could not load reference voices");
171
+ state.examples = await response.json();
172
+ state.examples.forEach((example, index) => {
173
+ elements.voiceLibrary.append(createVoiceOption(example, index));
174
+ });
175
+ if (state.examples.length) selectExample(state.examples[0]);
176
+ refreshIcons();
177
+ }
178
+
179
+ function setSource(source) {
180
+ state.source = source;
181
+ stopPreview();
182
+ document.querySelectorAll(".source-tab").forEach((tab) => {
183
+ const active = tab.dataset.source === source;
184
+ tab.classList.toggle("active", active);
185
+ tab.setAttribute("aria-selected", String(active));
186
+ });
187
+ elements.voiceLibrary.hidden = source !== "library";
188
+ elements.uploadPanel.hidden = source !== "upload";
189
+ if (source === "library" && state.selectedExample) {
190
+ elements.referenceText.value = state.selectedExample.transcript;
191
+ }
192
+ }
193
+
194
+ function showOutput(mode) {
195
+ elements.emptyOutput.hidden = mode !== "empty";
196
+ elements.loadingOutput.hidden = mode !== "loading";
197
+ elements.resultOutput.hidden = mode !== "result";
198
+ elements.errorOutput.hidden = mode !== "error";
199
+ elements.resultBadge.hidden = mode !== "result";
200
+ }
201
+
202
+ async function updateStatus() {
203
+ try {
204
+ const response = await fetch("/api/status", { cache: "no-store" });
205
+ const payload = await response.json();
206
+ const ready = payload.state === "ready";
207
+ elements.runtimeStatus.classList.toggle("ready", ready);
208
+ elements.runtimeLabel.textContent = ready ? "Model ready" : "Warming up";
209
+ } catch {
210
+ elements.runtimeStatus.classList.remove("ready");
211
+ elements.runtimeLabel.textContent = "Connecting";
212
+ }
213
+ }
214
+
215
+ function setGenerating(generating) {
216
+ elements.generateButton.disabled = generating || !elements.consent.checked;
217
+ elements.consent.disabled = generating;
218
+ elements.speechText.disabled = generating;
219
+ elements.referenceText.disabled = generating;
220
+ }
221
+
222
+ async function submitGeneration(event) {
223
+ event.preventDefault();
224
+ if (!elements.consent.checked) return;
225
+ if (state.source === "upload" && !elements.referenceAudio.files.length) {
226
+ showOutput("error");
227
+ elements.errorMessage.textContent = "Choose a reference audio file first.";
228
+ return;
229
+ }
230
+
231
+ const formData = new FormData(elements.form);
232
+ if (state.source === "library") {
233
+ formData.delete("reference_audio");
234
+ formData.set("example_id", state.selectedExample?.id || "");
235
+ }
236
+
237
+ showOutput("loading");
238
+ setGenerating(true);
239
+ const started = performance.now();
240
+ const phases = ["Encoding reference voice", "Generating acoustic tokens", "Decoding 44.1 kHz audio"];
241
+ let phase = 0;
242
+ const ticker = window.setInterval(() => {
243
+ const elapsed = (performance.now() - started) / 1000;
244
+ elements.elapsedTime.textContent = `${elapsed.toFixed(1)}s`;
245
+ const nextPhase = Math.min(phases.length - 1, Math.floor(elapsed / 8));
246
+ if (nextPhase !== phase) {
247
+ phase = nextPhase;
248
+ elements.loadingTitle.textContent = phases[phase];
249
+ }
250
+ }, 100);
251
+
252
+ try {
253
+ const response = await fetch("/api/generate", { method: "POST", body: formData });
254
+ if (!response.ok) {
255
+ const payload = await response.json().catch(() => ({}));
256
+ throw new Error(typeof payload.detail === "string" ? payload.detail : "The model could not generate audio.");
257
+ }
258
+
259
+ const blob = await response.blob();
260
+ if (state.resultUrl) URL.revokeObjectURL(state.resultUrl);
261
+ state.resultUrl = URL.createObjectURL(blob);
262
+ elements.resultAudio.src = state.resultUrl;
263
+ elements.downloadButton.href = state.resultUrl;
264
+ const serverMs = Number(response.headers.get("x-generation-duration-ms"));
265
+ const durationMs = Number.isFinite(serverMs) ? serverMs : performance.now() - started;
266
+ elements.generationTime.textContent = formatDuration(durationMs / 1000);
267
+ await drawWaveform(state.resultUrl, elements.resultWaveform, "#e64b2f");
268
+ showOutput("result");
269
+ elements.resultAudio.play().catch(() => {});
270
+ } catch (error) {
271
+ elements.errorMessage.textContent = error.message || "Unexpected generation error";
272
+ showOutput("error");
273
+ } finally {
274
+ window.clearInterval(ticker);
275
+ elements.loadingTitle.textContent = phases[0];
276
+ setGenerating(false);
277
+ }
278
+ }
279
+
280
+ document.querySelectorAll(".source-tab").forEach((tab) => {
281
+ tab.addEventListener("click", () => setSource(tab.dataset.source));
282
+ });
283
+
284
+ document.querySelectorAll(".text-presets button").forEach((button) => {
285
+ button.addEventListener("click", () => {
286
+ elements.speechText.value = textPresets[button.dataset.preset];
287
+ elements.speechText.dispatchEvent(new Event("input"));
288
+ elements.speechText.focus();
289
+ });
290
+ });
291
+
292
+ elements.referenceAudio.addEventListener("change", () => {
293
+ const file = elements.referenceAudio.files[0];
294
+ if (!file) return;
295
+ if (state.uploadUrl) URL.revokeObjectURL(state.uploadUrl);
296
+ state.uploadUrl = URL.createObjectURL(file);
297
+ elements.uploadPreview.src = state.uploadUrl;
298
+ elements.uploadPreview.hidden = false;
299
+ elements.uploadTitle.textContent = file.name;
300
+ });
301
+
302
+ elements.speechText.addEventListener("input", () => {
303
+ elements.characterCount.textContent = elements.speechText.value.length;
304
+ });
305
+
306
+ elements.consent.addEventListener("change", () => {
307
+ elements.generateButton.disabled = !elements.consent.checked;
308
+ });
309
+
310
+ elements.resultAudio.addEventListener("loadedmetadata", () => {
311
+ elements.audioDuration.textContent = formatDuration(elements.resultAudio.duration);
312
+ });
313
+
314
+ elements.form.addEventListener("submit", submitGeneration);
315
+
316
+ elements.characterCount.textContent = elements.speechText.value.length;
317
+ refreshIcons();
318
+ loadExamples().catch((error) => {
319
+ elements.errorMessage.textContent = error.message;
320
+ showOutput("error");
321
+ });
322
+ updateStatus();
323
+ window.setInterval(updateStatus, 5000);
static/index.html ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <meta name="theme-color" content="#f4f3ef" />
7
+ <meta
8
+ name="description"
9
+ content="Audio8 TTS Preview 0.6B multilingual voice cloning studio."
10
+ />
11
+ <title>Audio8 TTS Preview 0.6B</title>
12
+ <link rel="stylesheet" href="/static/styles.css" />
13
+ <script src="https://unpkg.com/lucide@0.468.0/dist/umd/lucide.min.js" defer></script>
14
+ <script src="/static/app.js" defer></script>
15
+ </head>
16
+ <body>
17
+ <header class="topbar">
18
+ <div class="topbar-inner">
19
+ <a class="brand" href="/" aria-label="Audio8 TTS Preview 0.6B">
20
+ <img src="/assets/audio8-logo.jpeg" alt="Audio8" />
21
+ <span class="brand-divider" aria-hidden="true"></span>
22
+ <span class="brand-product">TTS Preview 0.6B</span>
23
+ </a>
24
+ <nav class="top-actions" aria-label="Product links">
25
+ <a
26
+ class="icon-link"
27
+ href="https://huggingface.co/Audio8/Audio8-TTS-Preview-0.6b"
28
+ target="_blank"
29
+ rel="noreferrer"
30
+ >
31
+ <i data-lucide="box" aria-hidden="true"></i>
32
+ <span>Model</span>
33
+ </a>
34
+ <a class="icon-link" href="/docs" target="_blank">
35
+ <i data-lucide="code-2" aria-hidden="true"></i>
36
+ <span>API</span>
37
+ </a>
38
+ <div class="runtime-status" id="runtimeStatus" aria-live="polite">
39
+ <span class="status-dot"></span>
40
+ <span id="runtimeLabel">Warming up</span>
41
+ </div>
42
+ </nav>
43
+ </div>
44
+ </header>
45
+
46
+ <main>
47
+ <section class="title-band">
48
+ <div>
49
+ <p class="eyebrow">Audio8 TTS Preview 0.6B</p>
50
+ <h1>Clone a voice. Generate speech.</h1>
51
+ </div>
52
+ <div class="engine-mark">
53
+ <span>Multilingual</span>
54
+ <span class="engine-separator">/</span>
55
+ <span>44.1 kHz</span>
56
+ </div>
57
+ </section>
58
+
59
+ <section class="studio" aria-label="Voice cloning studio">
60
+ <form id="generationForm" class="controls-column">
61
+ <section class="control-section voice-section">
62
+ <div class="section-heading">
63
+ <div>
64
+ <span class="step-index">01</span>
65
+ <h2>Reference voice</h2>
66
+ </div>
67
+ <div class="source-tabs" role="tablist" aria-label="Reference source">
68
+ <button
69
+ class="source-tab active"
70
+ type="button"
71
+ role="tab"
72
+ aria-selected="true"
73
+ data-source="library"
74
+ >
75
+ Voices
76
+ </button>
77
+ <button
78
+ class="source-tab"
79
+ type="button"
80
+ role="tab"
81
+ aria-selected="false"
82
+ data-source="upload"
83
+ >
84
+ Upload
85
+ </button>
86
+ </div>
87
+ </div>
88
+
89
+ <div id="voiceLibrary" class="voice-library" role="radiogroup"></div>
90
+
91
+ <div id="uploadPanel" class="upload-panel" hidden>
92
+ <label class="upload-target" for="referenceAudio">
93
+ <i data-lucide="upload" aria-hidden="true"></i>
94
+ <span>
95
+ <strong id="uploadTitle">Choose reference audio</strong>
96
+ <small>WAV, MP3, FLAC, M4A or OGG, up to 15 MB</small>
97
+ </span>
98
+ </label>
99
+ <input
100
+ id="referenceAudio"
101
+ name="reference_audio"
102
+ type="file"
103
+ accept="audio/wav,audio/mpeg,audio/flac,audio/mp4,audio/ogg"
104
+ />
105
+ <audio id="uploadPreview" controls hidden></audio>
106
+ </div>
107
+
108
+ <label class="field-label" for="referenceText">
109
+ Reference transcript
110
+ <textarea
111
+ class="reference-transcript"
112
+ id="referenceText"
113
+ name="reference_text"
114
+ rows="2"
115
+ required
116
+ ></textarea>
117
+ </label>
118
+ </section>
119
+
120
+ <section class="control-section text-section">
121
+ <div class="section-heading">
122
+ <div>
123
+ <span class="step-index">02</span>
124
+ <h2>Speech text</h2>
125
+ </div>
126
+ <span class="character-count"><span id="characterCount">0</span>/1000</span>
127
+ </div>
128
+ <label class="sr-only" for="speechText">Text to generate</label>
129
+ <textarea
130
+ id="speechText"
131
+ name="text"
132
+ maxlength="1000"
133
+ rows="6"
134
+ required
135
+ >Every voice carries a story. With Audio8, that story can travel across languages and reach more people.</textarea>
136
+
137
+ <div class="text-presets" aria-label="Speech text presets">
138
+ <button type="button" data-preset="en">English</button>
139
+ <button type="button" data-preset="zh">中文</button>
140
+ <button type="button" data-preset="ja">日本語</button>
141
+ <button type="button" data-preset="es">Español</button>
142
+ </div>
143
+
144
+ <details class="settings">
145
+ <summary>
146
+ <span><i data-lucide="sliders-horizontal" aria-hidden="true"></i> Generation settings</span>
147
+ <i class="chevron" data-lucide="chevron-down" aria-hidden="true"></i>
148
+ </summary>
149
+ <div class="settings-grid">
150
+ <label>
151
+ Temperature
152
+ <input name="temperature" type="number" min="0" max="2" step="0.05" value="0.8" />
153
+ </label>
154
+ <label>
155
+ Top P
156
+ <input name="top_p" type="number" min="0.05" max="1" step="0.05" value="0.95" />
157
+ </label>
158
+ <label>
159
+ Top K
160
+ <input name="top_k" type="number" min="1" max="200" step="1" value="50" />
161
+ </label>
162
+ <label>
163
+ Max tokens
164
+ <input name="max_new_tokens" type="number" min="32" max="2048" step="32" value="1024" />
165
+ </label>
166
+ </div>
167
+ </details>
168
+
169
+ <label class="consent-row">
170
+ <input id="consent" type="checkbox" required />
171
+ <span>I have permission to use this reference voice.</span>
172
+ </label>
173
+
174
+ <button id="generateButton" class="generate-button" type="submit" disabled>
175
+ <i data-lucide="audio-lines" aria-hidden="true"></i>
176
+ <span>Generate speech</span>
177
+ <kbd>Audio8</kbd>
178
+ </button>
179
+ </section>
180
+ </form>
181
+
182
+ <aside class="output-column" aria-labelledby="outputHeading">
183
+ <div class="output-heading-row">
184
+ <div>
185
+ <span class="step-index">03</span>
186
+ <h2 id="outputHeading">Generated audio</h2>
187
+ </div>
188
+ <span id="resultBadge" class="result-badge" hidden>Ready</span>
189
+ </div>
190
+
191
+ <div id="emptyOutput" class="empty-output">
192
+ <div class="wave-display" aria-hidden="true">
193
+ <span></span><span></span><span></span><span></span><span></span>
194
+ <span></span><span></span><span></span><span></span><span></span>
195
+ <span></span><span></span><span></span><span></span><span></span>
196
+ </div>
197
+ <p>Your generated voice will appear here.</p>
198
+ <span>WAV / 44.1 kHz</span>
199
+ </div>
200
+
201
+ <div id="loadingOutput" class="loading-output" hidden aria-live="polite">
202
+ <div class="processing-mark" aria-hidden="true">
203
+ <span></span><span></span><span></span><span></span><span></span>
204
+ </div>
205
+ <strong id="loadingTitle">Encoding reference voice</strong>
206
+ <span id="elapsedTime">0.0s</span>
207
+ </div>
208
+
209
+ <div id="resultOutput" class="result-output" hidden>
210
+ <canvas id="resultWaveform" width="960" height="180"></canvas>
211
+ <audio id="resultAudio" controls></audio>
212
+ <div class="result-metrics">
213
+ <div>
214
+ <span>Generation</span>
215
+ <strong id="generationTime">--</strong>
216
+ </div>
217
+ <div>
218
+ <span>Audio</span>
219
+ <strong id="audioDuration">--</strong>
220
+ </div>
221
+ <div>
222
+ <span>Model</span>
223
+ <strong>Audio8 0.6B</strong>
224
+ </div>
225
+ </div>
226
+ <a id="downloadButton" class="download-button" download="audio8-clone.wav">
227
+ <i data-lucide="download" aria-hidden="true"></i>
228
+ Download WAV
229
+ </a>
230
+ </div>
231
+
232
+ <div id="errorOutput" class="error-output" hidden role="alert">
233
+ <i data-lucide="circle-alert" aria-hidden="true"></i>
234
+ <div>
235
+ <strong>Generation failed</strong>
236
+ <p id="errorMessage"></p>
237
+ </div>
238
+ </div>
239
+ </aside>
240
+ </section>
241
+ </main>
242
+
243
+ <footer>
244
+ <span>Audio8 TTS Preview</span>
245
+ <span>Use cloned voices with consent and disclose synthetic audio.</span>
246
+ </footer>
247
+ </body>
248
+ </html>
static/styles.css ADDED
@@ -0,0 +1,971 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root {
2
+ color-scheme: light;
3
+ --ink: #171717;
4
+ --muted: #6d6a66;
5
+ --line: #d9d7d1;
6
+ --line-strong: #b9b6ae;
7
+ --paper: #ffffff;
8
+ --ground: #f4f3ef;
9
+ --soft: #ebe9e3;
10
+ --accent: #e64b2f;
11
+ --accent-dark: #bd351f;
12
+ --green: #16745d;
13
+ --yellow: #f2c14e;
14
+ font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
15
+ font-synthesis: none;
16
+ }
17
+
18
+ * {
19
+ box-sizing: border-box;
20
+ }
21
+
22
+ html {
23
+ background: var(--ground);
24
+ }
25
+
26
+ body {
27
+ min-width: 320px;
28
+ min-height: 100vh;
29
+ margin: 0;
30
+ color: var(--ink);
31
+ background: var(--ground);
32
+ letter-spacing: 0;
33
+ }
34
+
35
+ button,
36
+ input,
37
+ textarea {
38
+ font: inherit;
39
+ letter-spacing: 0;
40
+ }
41
+
42
+ button,
43
+ a,
44
+ label,
45
+ summary {
46
+ -webkit-tap-highlight-color: transparent;
47
+ }
48
+
49
+ button:focus-visible,
50
+ a:focus-visible,
51
+ input:focus-visible,
52
+ textarea:focus-visible,
53
+ summary:focus-visible,
54
+ [role="radio"]:focus-visible {
55
+ outline: 3px solid rgba(230, 75, 47, 0.24);
56
+ outline-offset: 2px;
57
+ }
58
+
59
+ .topbar {
60
+ border-bottom: 1px solid var(--line);
61
+ background: rgba(255, 255, 255, 0.94);
62
+ }
63
+
64
+ .topbar-inner,
65
+ .title-band,
66
+ .studio,
67
+ footer {
68
+ width: min(1220px, calc(100% - 48px));
69
+ margin: 0 auto;
70
+ }
71
+
72
+ .topbar-inner {
73
+ min-height: 66px;
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: space-between;
77
+ gap: 24px;
78
+ }
79
+
80
+ .brand {
81
+ min-width: 0;
82
+ display: flex;
83
+ align-items: center;
84
+ gap: 14px;
85
+ color: inherit;
86
+ text-decoration: none;
87
+ }
88
+
89
+ .brand img {
90
+ display: block;
91
+ width: 142px;
92
+ height: 40px;
93
+ object-fit: contain;
94
+ }
95
+
96
+ .brand-divider {
97
+ width: 1px;
98
+ height: 22px;
99
+ background: var(--line-strong);
100
+ }
101
+
102
+ .brand-product {
103
+ overflow: hidden;
104
+ font-size: 15px;
105
+ font-weight: 700;
106
+ white-space: nowrap;
107
+ text-overflow: ellipsis;
108
+ }
109
+
110
+ .top-actions {
111
+ display: flex;
112
+ align-items: center;
113
+ gap: 8px;
114
+ }
115
+
116
+ .icon-link,
117
+ .runtime-status {
118
+ height: 36px;
119
+ display: inline-flex;
120
+ align-items: center;
121
+ gap: 7px;
122
+ padding: 0 11px;
123
+ border: 1px solid transparent;
124
+ border-radius: 6px;
125
+ color: #4c4945;
126
+ font-size: 13px;
127
+ font-weight: 650;
128
+ text-decoration: none;
129
+ white-space: nowrap;
130
+ }
131
+
132
+ .icon-link:hover {
133
+ border-color: var(--line);
134
+ background: var(--ground);
135
+ }
136
+
137
+ .icon-link svg {
138
+ width: 16px;
139
+ height: 16px;
140
+ }
141
+
142
+ .runtime-status {
143
+ border-color: var(--line);
144
+ background: var(--ground);
145
+ }
146
+
147
+ .status-dot {
148
+ width: 8px;
149
+ height: 8px;
150
+ flex: 0 0 8px;
151
+ border-radius: 50%;
152
+ background: var(--yellow);
153
+ box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.18);
154
+ }
155
+
156
+ .runtime-status.ready .status-dot {
157
+ background: var(--green);
158
+ box-shadow: 0 0 0 3px rgba(22, 116, 93, 0.16);
159
+ }
160
+
161
+ main {
162
+ padding-bottom: 40px;
163
+ }
164
+
165
+ .title-band {
166
+ min-height: 158px;
167
+ display: flex;
168
+ align-items: flex-end;
169
+ justify-content: space-between;
170
+ gap: 32px;
171
+ padding: 46px 0 28px;
172
+ }
173
+
174
+ .eyebrow {
175
+ margin: 0 0 9px;
176
+ color: var(--accent-dark);
177
+ font-size: 12px;
178
+ font-weight: 800;
179
+ text-transform: uppercase;
180
+ }
181
+
182
+ h1,
183
+ h2,
184
+ p {
185
+ margin-top: 0;
186
+ }
187
+
188
+ h1 {
189
+ max-width: 680px;
190
+ margin-bottom: 0;
191
+ font-size: 34px;
192
+ line-height: 1.1;
193
+ font-weight: 750;
194
+ }
195
+
196
+ .engine-mark {
197
+ display: flex;
198
+ align-items: center;
199
+ gap: 9px;
200
+ padding-bottom: 5px;
201
+ color: var(--muted);
202
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
203
+ font-size: 12px;
204
+ white-space: nowrap;
205
+ }
206
+
207
+ .engine-separator {
208
+ color: var(--accent);
209
+ }
210
+
211
+ .studio {
212
+ display: grid;
213
+ grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
214
+ min-height: 690px;
215
+ overflow: hidden;
216
+ border: 1px solid var(--line-strong);
217
+ border-radius: 8px;
218
+ background: var(--paper);
219
+ box-shadow: 0 18px 60px rgba(32, 29, 25, 0.07);
220
+ }
221
+
222
+ .controls-column,
223
+ .output-column {
224
+ min-width: 0;
225
+ }
226
+
227
+ .control-section {
228
+ padding: 28px 30px;
229
+ }
230
+
231
+ .control-section + .control-section {
232
+ border-top: 1px solid var(--line);
233
+ }
234
+
235
+ .section-heading,
236
+ .output-heading-row {
237
+ display: flex;
238
+ align-items: center;
239
+ justify-content: space-between;
240
+ gap: 20px;
241
+ margin-bottom: 20px;
242
+ }
243
+
244
+ .section-heading > div:first-child,
245
+ .output-heading-row > div:first-child {
246
+ display: flex;
247
+ align-items: baseline;
248
+ gap: 12px;
249
+ }
250
+
251
+ .step-index {
252
+ color: var(--accent);
253
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
254
+ font-size: 11px;
255
+ font-weight: 800;
256
+ }
257
+
258
+ h2 {
259
+ margin-bottom: 0;
260
+ font-size: 18px;
261
+ line-height: 1.2;
262
+ font-weight: 750;
263
+ }
264
+
265
+ .source-tabs {
266
+ display: grid;
267
+ grid-template-columns: 1fr 1fr;
268
+ width: 150px;
269
+ height: 34px;
270
+ padding: 3px;
271
+ border-radius: 6px;
272
+ background: var(--soft);
273
+ }
274
+
275
+ .source-tab {
276
+ border: 0;
277
+ border-radius: 4px;
278
+ color: var(--muted);
279
+ background: transparent;
280
+ cursor: pointer;
281
+ font-size: 12px;
282
+ font-weight: 750;
283
+ }
284
+
285
+ .source-tab.active {
286
+ color: var(--ink);
287
+ background: var(--paper);
288
+ box-shadow: 0 1px 3px rgba(28, 25, 22, 0.14);
289
+ }
290
+
291
+ .voice-library {
292
+ display: grid;
293
+ grid-template-columns: repeat(3, minmax(0, 1fr));
294
+ margin-bottom: 22px;
295
+ border-top: 1px solid var(--line);
296
+ border-left: 1px solid var(--line);
297
+ }
298
+
299
+ .voice-option {
300
+ position: relative;
301
+ min-width: 0;
302
+ height: 104px;
303
+ display: grid;
304
+ grid-template-columns: 34px minmax(0, 1fr);
305
+ grid-template-rows: auto 30px;
306
+ column-gap: 10px;
307
+ align-items: center;
308
+ padding: 13px 12px;
309
+ border-right: 1px solid var(--line);
310
+ border-bottom: 1px solid var(--line);
311
+ background: var(--paper);
312
+ cursor: pointer;
313
+ transition: background 140ms ease, box-shadow 140ms ease;
314
+ }
315
+
316
+ .voice-option:hover {
317
+ background: #faf9f6;
318
+ }
319
+
320
+ .voice-option.selected {
321
+ z-index: 1;
322
+ background: #fff8f5;
323
+ box-shadow: inset 0 0 0 2px var(--accent);
324
+ }
325
+
326
+ .voice-play {
327
+ width: 32px;
328
+ height: 32px;
329
+ display: inline-flex;
330
+ align-items: center;
331
+ justify-content: center;
332
+ grid-row: 1;
333
+ padding: 0;
334
+ border: 1px solid var(--line-strong);
335
+ border-radius: 50%;
336
+ color: var(--ink);
337
+ background: var(--paper);
338
+ cursor: pointer;
339
+ }
340
+
341
+ .voice-play:hover {
342
+ color: var(--paper);
343
+ border-color: var(--ink);
344
+ background: var(--ink);
345
+ }
346
+
347
+ .voice-play svg {
348
+ width: 14px;
349
+ height: 14px;
350
+ }
351
+
352
+ .voice-meta {
353
+ min-width: 0;
354
+ grid-row: 1;
355
+ }
356
+
357
+ .voice-meta strong,
358
+ .voice-meta span {
359
+ display: block;
360
+ overflow: hidden;
361
+ white-space: nowrap;
362
+ text-overflow: ellipsis;
363
+ }
364
+
365
+ .voice-meta strong {
366
+ margin-bottom: 3px;
367
+ font-size: 13px;
368
+ }
369
+
370
+ .voice-meta span {
371
+ color: var(--muted);
372
+ font-size: 10px;
373
+ }
374
+
375
+ .voice-option canvas {
376
+ width: 100%;
377
+ height: 28px;
378
+ grid-column: 1 / -1;
379
+ grid-row: 2;
380
+ }
381
+
382
+ .upload-panel {
383
+ margin-bottom: 20px;
384
+ }
385
+
386
+ .upload-target {
387
+ min-height: 108px;
388
+ display: flex;
389
+ align-items: center;
390
+ justify-content: center;
391
+ gap: 14px;
392
+ padding: 20px;
393
+ border: 1px dashed var(--line-strong);
394
+ border-radius: 6px;
395
+ background: #faf9f6;
396
+ cursor: pointer;
397
+ }
398
+
399
+ .upload-target:hover {
400
+ border-color: var(--accent);
401
+ background: #fff8f5;
402
+ }
403
+
404
+ .upload-target svg {
405
+ width: 22px;
406
+ height: 22px;
407
+ color: var(--accent);
408
+ }
409
+
410
+ .upload-target strong,
411
+ .upload-target small {
412
+ display: block;
413
+ }
414
+
415
+ .upload-target strong {
416
+ margin-bottom: 4px;
417
+ font-size: 13px;
418
+ }
419
+
420
+ .upload-target small {
421
+ color: var(--muted);
422
+ font-size: 11px;
423
+ }
424
+
425
+ #referenceAudio {
426
+ position: absolute;
427
+ width: 1px;
428
+ height: 1px;
429
+ overflow: hidden;
430
+ clip: rect(0, 0, 0, 0);
431
+ }
432
+
433
+ #uploadPreview {
434
+ width: 100%;
435
+ height: 42px;
436
+ margin-top: 12px;
437
+ }
438
+
439
+ .field-label,
440
+ .settings-grid label {
441
+ display: block;
442
+ color: #4f4b47;
443
+ font-size: 11px;
444
+ font-weight: 750;
445
+ }
446
+
447
+ .field-label input,
448
+ .settings-grid input {
449
+ width: 100%;
450
+ height: 42px;
451
+ margin-top: 8px;
452
+ padding: 0 12px;
453
+ border: 1px solid var(--line);
454
+ border-radius: 5px;
455
+ color: var(--ink);
456
+ background: var(--paper);
457
+ }
458
+
459
+ .field-label .reference-transcript {
460
+ min-height: 62px;
461
+ margin-top: 8px;
462
+ padding: 10px 12px;
463
+ resize: vertical;
464
+ font-size: 12px;
465
+ line-height: 1.55;
466
+ }
467
+
468
+ .field-label input:focus,
469
+ .settings-grid input:focus,
470
+ textarea:focus {
471
+ border-color: var(--accent);
472
+ outline: 0;
473
+ box-shadow: 0 0 0 3px rgba(230, 75, 47, 0.11);
474
+ }
475
+
476
+ .character-count {
477
+ color: var(--muted);
478
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
479
+ font-size: 11px;
480
+ }
481
+
482
+ textarea {
483
+ width: 100%;
484
+ min-height: 142px;
485
+ resize: vertical;
486
+ display: block;
487
+ padding: 15px 16px;
488
+ border: 1px solid var(--line);
489
+ border-radius: 5px;
490
+ color: var(--ink);
491
+ background: #fdfcf9;
492
+ font-size: 15px;
493
+ line-height: 1.65;
494
+ }
495
+
496
+ .text-presets {
497
+ display: flex;
498
+ flex-wrap: wrap;
499
+ gap: 7px;
500
+ margin-top: 11px;
501
+ }
502
+
503
+ .text-presets button {
504
+ height: 30px;
505
+ padding: 0 10px;
506
+ border: 1px solid var(--line);
507
+ border-radius: 5px;
508
+ color: #4f4b47;
509
+ background: var(--paper);
510
+ cursor: pointer;
511
+ font-size: 11px;
512
+ font-weight: 700;
513
+ }
514
+
515
+ .text-presets button:hover {
516
+ color: var(--accent-dark);
517
+ border-color: var(--accent);
518
+ background: #fff8f5;
519
+ }
520
+
521
+ .settings {
522
+ margin-top: 16px;
523
+ border-top: 1px solid var(--line);
524
+ border-bottom: 1px solid var(--line);
525
+ }
526
+
527
+ .settings summary {
528
+ height: 46px;
529
+ display: flex;
530
+ align-items: center;
531
+ justify-content: space-between;
532
+ color: #4f4b47;
533
+ cursor: pointer;
534
+ font-size: 12px;
535
+ font-weight: 700;
536
+ list-style: none;
537
+ }
538
+
539
+ .settings summary::-webkit-details-marker {
540
+ display: none;
541
+ }
542
+
543
+ .settings summary span {
544
+ display: inline-flex;
545
+ align-items: center;
546
+ gap: 8px;
547
+ }
548
+
549
+ .settings summary svg {
550
+ width: 15px;
551
+ height: 15px;
552
+ }
553
+
554
+ .settings .chevron {
555
+ transition: transform 160ms ease;
556
+ }
557
+
558
+ .settings[open] .chevron {
559
+ transform: rotate(180deg);
560
+ }
561
+
562
+ .settings-grid {
563
+ display: grid;
564
+ grid-template-columns: repeat(4, minmax(0, 1fr));
565
+ gap: 12px;
566
+ padding: 4px 0 16px;
567
+ }
568
+
569
+ .consent-row {
570
+ display: flex;
571
+ align-items: center;
572
+ gap: 9px;
573
+ margin: 18px 0 15px;
574
+ color: #4f4b47;
575
+ cursor: pointer;
576
+ font-size: 12px;
577
+ }
578
+
579
+ .consent-row input {
580
+ width: 17px;
581
+ height: 17px;
582
+ margin: 0;
583
+ accent-color: var(--accent);
584
+ }
585
+
586
+ .generate-button,
587
+ .download-button {
588
+ width: 100%;
589
+ height: 50px;
590
+ display: flex;
591
+ align-items: center;
592
+ justify-content: center;
593
+ gap: 10px;
594
+ border: 0;
595
+ border-radius: 6px;
596
+ color: var(--paper);
597
+ background: var(--ink);
598
+ cursor: pointer;
599
+ font-size: 14px;
600
+ font-weight: 750;
601
+ text-decoration: none;
602
+ }
603
+
604
+ .generate-button:hover:not(:disabled),
605
+ .download-button:hover {
606
+ background: var(--accent-dark);
607
+ }
608
+
609
+ .generate-button:disabled {
610
+ color: #a5a29c;
611
+ background: #dedcd6;
612
+ cursor: not-allowed;
613
+ }
614
+
615
+ .generate-button svg,
616
+ .download-button svg {
617
+ width: 18px;
618
+ height: 18px;
619
+ }
620
+
621
+ .generate-button kbd {
622
+ position: absolute;
623
+ right: 44px;
624
+ padding: 3px 6px;
625
+ border: 1px solid rgba(255, 255, 255, 0.25);
626
+ border-radius: 4px;
627
+ color: rgba(255, 255, 255, 0.68);
628
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
629
+ font-size: 9px;
630
+ font-weight: 600;
631
+ }
632
+
633
+ .generate-button {
634
+ position: relative;
635
+ }
636
+
637
+ .output-column {
638
+ min-height: 100%;
639
+ display: flex;
640
+ flex-direction: column;
641
+ padding: 28px 30px 30px;
642
+ border-left: 1px solid var(--line-strong);
643
+ background: #f8f7f3;
644
+ }
645
+
646
+ .result-badge {
647
+ padding: 5px 8px;
648
+ border-radius: 4px;
649
+ color: var(--green);
650
+ background: rgba(22, 116, 93, 0.1);
651
+ font-size: 10px;
652
+ font-weight: 800;
653
+ text-transform: uppercase;
654
+ }
655
+
656
+ .empty-output,
657
+ .loading-output {
658
+ min-height: 400px;
659
+ flex: 1;
660
+ display: flex;
661
+ flex-direction: column;
662
+ align-items: center;
663
+ justify-content: center;
664
+ text-align: center;
665
+ }
666
+
667
+ .empty-output p {
668
+ margin: 22px 0 7px;
669
+ font-size: 14px;
670
+ font-weight: 700;
671
+ }
672
+
673
+ .empty-output > span {
674
+ color: var(--muted);
675
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
676
+ font-size: 10px;
677
+ }
678
+
679
+ .wave-display {
680
+ height: 84px;
681
+ display: flex;
682
+ align-items: center;
683
+ gap: 5px;
684
+ }
685
+
686
+ .wave-display span {
687
+ width: 4px;
688
+ border-radius: 2px;
689
+ background: #cbc8c0;
690
+ }
691
+
692
+ .wave-display span:nth-child(1),
693
+ .wave-display span:nth-child(15) { height: 16px; }
694
+ .wave-display span:nth-child(2),
695
+ .wave-display span:nth-child(14) { height: 28px; }
696
+ .wave-display span:nth-child(3),
697
+ .wave-display span:nth-child(13) { height: 42px; }
698
+ .wave-display span:nth-child(4),
699
+ .wave-display span:nth-child(12) { height: 25px; }
700
+ .wave-display span:nth-child(5),
701
+ .wave-display span:nth-child(11) { height: 58px; }
702
+ .wave-display span:nth-child(6),
703
+ .wave-display span:nth-child(10) { height: 34px; }
704
+ .wave-display span:nth-child(7),
705
+ .wave-display span:nth-child(9) { height: 70px; }
706
+ .wave-display span:nth-child(8) { height: 48px; background: var(--accent); }
707
+
708
+ .loading-output strong {
709
+ margin-top: 22px;
710
+ font-size: 14px;
711
+ }
712
+
713
+ .loading-output > span {
714
+ margin-top: 7px;
715
+ color: var(--muted);
716
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
717
+ font-size: 11px;
718
+ }
719
+
720
+ .processing-mark {
721
+ height: 74px;
722
+ display: flex;
723
+ align-items: center;
724
+ gap: 6px;
725
+ }
726
+
727
+ .processing-mark span {
728
+ width: 5px;
729
+ height: 32px;
730
+ border-radius: 3px;
731
+ background: var(--accent);
732
+ animation: processing 900ms ease-in-out infinite alternate;
733
+ }
734
+
735
+ .processing-mark span:nth-child(2) { animation-delay: 120ms; }
736
+ .processing-mark span:nth-child(3) { animation-delay: 240ms; }
737
+ .processing-mark span:nth-child(4) { animation-delay: 360ms; }
738
+ .processing-mark span:nth-child(5) { animation-delay: 480ms; }
739
+
740
+ @keyframes processing {
741
+ from { height: 18px; opacity: 0.45; }
742
+ to { height: 62px; opacity: 1; }
743
+ }
744
+
745
+ .result-output {
746
+ flex: 1;
747
+ }
748
+
749
+ #resultWaveform {
750
+ width: 100%;
751
+ height: 180px;
752
+ display: block;
753
+ margin: 20px 0 26px;
754
+ border-bottom: 1px solid var(--line);
755
+ }
756
+
757
+ #resultAudio {
758
+ width: 100%;
759
+ height: 48px;
760
+ }
761
+
762
+ .result-metrics {
763
+ display: grid;
764
+ grid-template-columns: repeat(3, 1fr);
765
+ margin: 24px 0;
766
+ border-top: 1px solid var(--line);
767
+ border-bottom: 1px solid var(--line);
768
+ }
769
+
770
+ .result-metrics div {
771
+ min-width: 0;
772
+ padding: 14px 12px;
773
+ }
774
+
775
+ .result-metrics div + div {
776
+ border-left: 1px solid var(--line);
777
+ }
778
+
779
+ .result-metrics span,
780
+ .result-metrics strong {
781
+ display: block;
782
+ overflow: hidden;
783
+ white-space: nowrap;
784
+ text-overflow: ellipsis;
785
+ }
786
+
787
+ .result-metrics span {
788
+ margin-bottom: 5px;
789
+ color: var(--muted);
790
+ font-size: 9px;
791
+ font-weight: 700;
792
+ text-transform: uppercase;
793
+ }
794
+
795
+ .result-metrics strong {
796
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
797
+ font-size: 12px;
798
+ }
799
+
800
+ .error-output {
801
+ display: flex;
802
+ gap: 12px;
803
+ margin-top: 24px;
804
+ padding: 15px;
805
+ border: 1px solid rgba(189, 53, 31, 0.35);
806
+ border-radius: 6px;
807
+ color: #8f2919;
808
+ background: #fff3ef;
809
+ }
810
+
811
+ .error-output svg {
812
+ width: 20px;
813
+ height: 20px;
814
+ flex: 0 0 20px;
815
+ }
816
+
817
+ .error-output strong {
818
+ font-size: 13px;
819
+ }
820
+
821
+ .error-output p {
822
+ margin: 4px 0 0;
823
+ font-size: 12px;
824
+ line-height: 1.5;
825
+ }
826
+
827
+ footer {
828
+ min-height: 70px;
829
+ display: flex;
830
+ align-items: center;
831
+ justify-content: space-between;
832
+ gap: 20px;
833
+ color: var(--muted);
834
+ font-size: 11px;
835
+ }
836
+
837
+ .sr-only {
838
+ position: absolute;
839
+ width: 1px;
840
+ height: 1px;
841
+ padding: 0;
842
+ margin: -1px;
843
+ overflow: hidden;
844
+ clip: rect(0, 0, 0, 0);
845
+ white-space: nowrap;
846
+ border: 0;
847
+ }
848
+
849
+ [hidden] {
850
+ display: none !important;
851
+ }
852
+
853
+ @media (max-width: 920px) {
854
+ .studio {
855
+ grid-template-columns: 1fr;
856
+ }
857
+
858
+ .output-column {
859
+ min-height: 560px;
860
+ border-top: 1px solid var(--line-strong);
861
+ border-left: 0;
862
+ }
863
+
864
+ .voice-library {
865
+ grid-template-columns: repeat(2, minmax(0, 1fr));
866
+ }
867
+ }
868
+
869
+ @media (max-width: 640px) {
870
+ .topbar-inner,
871
+ .title-band,
872
+ .studio,
873
+ footer {
874
+ width: min(100% - 24px, 1220px);
875
+ }
876
+
877
+ .topbar-inner {
878
+ min-height: 58px;
879
+ gap: 10px;
880
+ }
881
+
882
+ .brand {
883
+ gap: 8px;
884
+ }
885
+
886
+ .brand img {
887
+ width: 100px;
888
+ height: 34px;
889
+ }
890
+
891
+ .brand-product,
892
+ .brand-divider,
893
+ .icon-link span,
894
+ .runtime-status span:last-child {
895
+ display: none;
896
+ }
897
+
898
+ .icon-link,
899
+ .runtime-status {
900
+ width: 34px;
901
+ padding: 0;
902
+ justify-content: center;
903
+ }
904
+
905
+ .title-band {
906
+ min-height: 138px;
907
+ align-items: flex-start;
908
+ flex-direction: column;
909
+ justify-content: flex-end;
910
+ gap: 16px;
911
+ padding: 34px 0 24px;
912
+ }
913
+
914
+ h1 {
915
+ font-size: 28px;
916
+ }
917
+
918
+ .engine-mark {
919
+ padding: 0;
920
+ }
921
+
922
+ .control-section,
923
+ .output-column {
924
+ padding: 23px 18px;
925
+ }
926
+
927
+ .section-heading,
928
+ .output-heading-row {
929
+ gap: 12px;
930
+ }
931
+
932
+ .source-tabs {
933
+ width: 132px;
934
+ }
935
+
936
+ .voice-option {
937
+ height: 100px;
938
+ padding: 11px 9px;
939
+ }
940
+
941
+ .settings-grid {
942
+ grid-template-columns: repeat(2, minmax(0, 1fr));
943
+ }
944
+
945
+ .generate-button kbd {
946
+ display: none;
947
+ }
948
+
949
+ .empty-output,
950
+ .loading-output {
951
+ min-height: 320px;
952
+ }
953
+
954
+ footer {
955
+ align-items: flex-start;
956
+ flex-direction: column;
957
+ justify-content: center;
958
+ padding: 18px 0;
959
+ }
960
+ }
961
+
962
+ @media (prefers-reduced-motion: reduce) {
963
+ *,
964
+ *::before,
965
+ *::after {
966
+ scroll-behavior: auto !important;
967
+ animation-duration: 0.01ms !important;
968
+ animation-iteration-count: 1 !important;
969
+ transition-duration: 0.01ms !important;
970
+ }
971
+ }