Spaces:
Running
Running
Commit
·
41dd8e5
1
Parent(s):
9f83ce7
fix
Browse files- Dockerfile +1 -4
- README.md +1 -34
- requirements.txt +1 -1
- spaces.yaml +1 -2
Dockerfile
CHANGED
|
@@ -4,10 +4,7 @@ ENV PYTHONUNBUFFERED=1 \
|
|
| 4 |
PIP_NO_CACHE_DIR=1 \
|
| 5 |
HF_HOME=/data/cache
|
| 6 |
|
| 7 |
-
|
| 8 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
-
ffmpeg git curl ca-certificates && \
|
| 10 |
-
rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
WORKDIR /app
|
| 13 |
|
|
|
|
| 4 |
PIP_NO_CACHE_DIR=1 \
|
| 5 |
HF_HOME=/data/cache
|
| 6 |
|
| 7 |
+
RUN apt-get update
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
WORKDIR /app
|
| 10 |
|
README.md
CHANGED
|
@@ -9,37 +9,4 @@ 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 |
-
```json
|
| 24 |
-
{
|
| 25 |
-
"text": "Hello from XTTS",
|
| 26 |
-
"speaker_wav": "https://.../sample.wav or base64 string",
|
| 27 |
-
"language": "en"
|
| 28 |
-
}
|
| 29 |
-
```
|
| 30 |
-
|
| 31 |
-
## Smoke tests
|
| 32 |
-
```bash
|
| 33 |
-
curl -X POST https://<space>.hf.space/health \
|
| 34 |
-
-H "x-api-key: $SPACE_API_KEY"
|
| 35 |
-
|
| 36 |
-
curl -X POST https://<space>.hf.space/generate \
|
| 37 |
-
-H "Content-Type: application/json" \
|
| 38 |
-
-H "x-api-key: $SPACE_API_KEY" \
|
| 39 |
-
-d '{"text":"Hello from XTTS","speaker_wav":"https://.../sample.wav"}' \
|
| 40 |
-
--output out.wav
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
## Notes
|
| 44 |
-
- Hardware: request T4 GPU for best latency (CPU works but slower).
|
| 45 |
-
- Env vars for clients: `HF_SPACES_API_URL`, `HF_SPACES_API_KEY`.
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
# XTTS v2 FastAPI Space
|
| 12 |
+
...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -4,7 +4,7 @@ uvicorn==0.24.0
|
|
| 4 |
python-multipart==0.0.6
|
| 5 |
requests==2.31.0
|
| 6 |
numpy==1.26.4
|
| 7 |
-
|
| 8 |
# Use CPU wheels by default; HF GPU image will still use CUDA when available.
|
| 9 |
torch==2.1.0 --index-url https://download.pytorch.org/whl/cpu
|
| 10 |
torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cpu
|
|
|
|
| 4 |
python-multipart==0.0.6
|
| 5 |
requests==2.31.0
|
| 6 |
numpy==1.26.4
|
| 7 |
+
uv
|
| 8 |
# Use CPU wheels by default; HF GPU image will still use CUDA when available.
|
| 9 |
torch==2.1.0 --index-url https://download.pytorch.org/whl/cpu
|
| 10 |
torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cpu
|
spaces.yaml
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
title: xtts-v2-api
|
| 2 |
sdk: docker
|
| 3 |
-
|
| 4 |
-
app_file: app.py
|
|
|
|
| 1 |
title: xtts-v2-api
|
| 2 |
sdk: docker
|
| 3 |
+
dockerfile: Dockerfile
|
|
|