ataberkkilavuzcu commited on
Commit
8f5ae34
·
1 Parent(s): be85c0f

readme fixed.

Browse files
Files changed (1) hide show
  1. README.md +32 -42
README.md CHANGED
@@ -1,47 +1,37 @@
1
- # XTTS v2 Hugging Face Space (FastAPI)
 
 
 
 
 
 
 
 
2
 
3
- This folder holds ready-to-push files for a Spaces deployment that exposes XTTS v2 via FastAPI.
4
 
5
- ## Files
6
- - `app.py` – FastAPI app with `/health` and `/generate` (URL or base64 speaker input).
7
- - `requirements.txt` – pinned dependencies.
8
- - `Dockerfile` – runs uvicorn; installs ffmpeg and deps.
9
- - `spaces.yaml` – tells Spaces to use the Dockerfile.
10
 
11
- ## How to deploy on Hugging Face Spaces
12
- 1) Create a new Space (recommend `Public`, SDK: **Docker**). Name it `xtts-v2-api`.
13
- 2) Clone it locally:
14
- ```bash
15
- huggingface-cli repo clone spaces/<username>/xtts-v2-api
16
- cd xtts-v2-api
17
- ```
18
- 3) Copy these files into the Space repo (overwrite if prompted).
19
- 4) Install Git LFS (one time): `git lfs install`.
20
- 5) Commit and push:
21
- ```bash
22
- git add .
23
- git commit -m "Add XTTS v2 FastAPI Space"
24
- git push
25
- ```
26
- 6) In Space Settings → Secrets, add `SPACE_API_KEY=<your-shared-secret>` (optional but recommended).
27
- 7) In Space Settings → Hardware, choose `T4 GPU` if available. CPU works but slower.
28
- 8) Wait for the build; first startup may take 2–4 minutes. Check Logs if build fails.
29
 
30
- ## Smoke tests (after Space is live)
31
- - Health:
32
- ```bash
33
- curl -X POST https://<space>.hf.space/health -H "x-api-key: $SPACE_API_KEY"
34
- ```
35
- - Generate (URL speaker):
36
- ```bash
37
- curl -X POST https://<space>.hf.space/generate \
38
- -H "Content-Type: application/json" \
39
- -H "x-api-key: $SPACE_API_KEY" \
40
- -d '{"text":"Hello from XTTS","speaker_wav":"https://.../sample.wav"}' \
41
- --output out.wav
42
- ```
43
 
44
- ## Integration notes
45
- - Next.js should call `/generate` with `text`, `speaker_wav` (signed Supabase URL or base64), optional `language`.
46
- - Set envs in Vercel: `HF_SPACES_API_URL`, `HF_SPACES_API_KEY`.
47
- - On errors, the API returns `{ "error": "message" }` with 4xx/5xx.
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: xtts-v2-api
3
+ emoji: 🗣️
4
+ colorFrom: purple
5
+ colorTo: blue
6
+ sdk: docker
7
+ app_file: app.py
8
+ pinned: false
9
+ ---
10
 
11
+ # XTTS v2 FastAPI Space
12
 
13
+ FastAPI service exposing XTTS v2 for text-to-speech and voice cloning.
 
 
 
 
14
 
15
+ ## Endpoints
16
+ - `POST /health` `{ status: "ok", model: "xtts_v2", device: "cuda|cpu" }`
17
+ - `POST /generate` → returns `audio/wav` bytes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
+ ## Auth
20
+ Send header `x-api-key: $SPACE_API_KEY` (set this secret in Space settings).
 
 
 
 
 
 
 
 
 
 
 
21
 
22
+ ## Request body (`/generate`)
23
+ {
24
+ "text": "Hello from XTTS",
25
+ "speaker_wav": "https://.../sample.wav or base64 string",
26
+ "language": "en"
27
+ }## Smoke tests
28
+ curl -X POST https://<space>.hf.space/health \
29
+ -H "x-api-key: $SPACE_API_KEY"
30
+
31
+ curl -X POST https://<space>.hf.space/generate \
32
+ -H "Content-Type: application/json" \
33
+ -H "x-api-key: $SPACE_API_KEY" \
34
+ -d '{"text":"Hello from XTTS","speaker_wav":"https://.../sample.wav"}' \
35
+ --output out.wav## Notes
36
+ - Hardware: request T4 GPU for best latency (CPU works but slower).
37
+ - Env vars for clients: `HF_SPACES_API_URL`, `HF_SPACES_API_KEY`.