File size: 1,738 Bytes
320b8e3
277dec7
69692b7
320b8e3
277dec7
 
320b8e3
69692b7
320b8e3
 
277dec7
320b8e3
277dec7
320b8e3
69692b7
320b8e3
277dec7
 
 
 
 
320b8e3
277dec7
320b8e3
277dec7
 
320b8e3
277dec7
9a9e06c
277dec7
 
 
 
 
 
 
 
7a3cf8c
320b8e3
277dec7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69692b7
277dec7
7a3cf8c
277dec7
 
 
 
7a3cf8c
277dec7
320b8e3
277dec7
 
 
 
320b8e3
277dec7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: Matcha TTS API
emoji: 🗣️
colorFrom: blue
colorTo: red
sdk: docker
app_port: 7860
pinned: false
---

# Matcha TTS Space

A Hugging Face Space deployment of **Matcha-TTS** for fast, high-quality text-to-speech synthesis on CPU Basic.

## Features

- **Fast**: Real-time factor (RTF) ~0.1-0.15 on CPU Basic
- **High Quality**: Natural-sounding speech with good prosody
- **Simple API**: REST endpoint for TTS synthesis
- **CPU Optimized**: Uses ONNX runtime for efficient inference
- **Configurable**: Supports different Matcha-TTS models via environment variable

## API Endpoints

### POST `/tts`
Synthesize speech from text.

**Request Body:**
```json
{
  "text": "Hello world",
  "language": "en",
  "speaker_id": 0,
  "noise_scale": 0.667,
  "noise_scale_w": 0.8,
  "length_scale": 1.0
}
```

**Returns:** WAV audio file (24kHz, 16-bit PCM)

### GET `/health`
Health check endpoint.

### GET `/`
API information and usage example.

## Usage Example (curl)

```bash
curl -X POST "https://your-username-your-space.hf.space/tts" \
  -H "Content-Type: application/json" \
  -d '{"text":"Hello, this is Matcha TTS!"}' \
  -o output.wav
```

## Model

Default: `matcha-tts/matcha-v1.0` (English)

To use a different model, set the `MATCHA_MODEL` environment variable in Space Settings.

## Performance

On Hugging Face CPU Basic:
- Startup time: ~10-15 seconds (model loading)
- Synthesis RTF: ~0.1-0.15 (1 second of audio in 100-150ms)
- Concurrent requests: Limited by CPU, recommend sequential processing

## Deployment

This Space is built from:
- `Dockerfile`: Container definition
- `requirements.txt`: Python dependencies
- `main.py`: FastAPI application

Built and deployed automatically on pushes to the main branch.