File size: 4,454 Bytes
8f5564a | 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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | ---
title: Soprano TTS API
emoji: 🎤
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: apache-2.0
app_port: 7860
---
# Soprano TTS API Space
This Hugging Face Space provides a REST API for the Soprano Text-to-Speech model loaded from [Gaston895/aegis001](https://huggingface.co/Gaston895/aegis001). Soprano is an ultra-lightweight, on-device TTS model designed for expressive, high-fidelity speech synthesis.
## Model Source
This space automatically loads the Soprano TTS model from the Hugging Face repository:
- **Repository**: [Gaston895/aegis001](https://huggingface.co/Gaston895/aegis001)
- **Model Type**: Qwen3ForCausalLM optimized for text-to-speech
- **Parameters**: 80M parameters
- **Architecture**: Ultra-lightweight design for CPU inference
## Features
- **Ultra-fast generation**: Optimized for CPU inference on Hugging Face Spaces
- **Low memory usage**: <1GB memory footprint
- **High quality**: Crystal clear 32kHz audio generation
- **REST API**: Easy integration with any application
- **Automatic model loading**: Downloads model from HF repository on startup
## API Endpoints
### Health Check
```bash
GET /health
```
### Single Text Synthesis
```bash
POST /synthesize
Content-Type: application/json
{
"text": "Hello, this is Soprano TTS speaking!",
"temperature": 0.7,
"top_p": 0.9,
"format": "wav"
}
```
### Batch Text Synthesis
```bash
POST /batch_synthesize
Content-Type: application/json
{
"texts": [
"First sentence to synthesize.",
"Second sentence to synthesize."
],
"temperature": 0.7,
"top_p": 0.9
}
```
## Parameters
- **text** (required): Text to synthesize
- **temperature** (optional): Controls randomness (0.1-2.0, default: 0.7)
- **top_p** (optional): Controls diversity (0.1-1.0, default: 0.9)
- **format** (optional): Output format - "wav" or "base64" (default: "wav")
## Response Formats
### WAV File Response
Returns audio file directly for download.
### Base64 Response
```json
{
"success": true,
"audio_base64": "UklGRiQAAABXQVZFZm10...",
"sample_rate": 32000,
"duration": 2.5,
"text": "Input text"
}
```
## Usage Examples
### cURL
```bash
# Synthesize text and save as WAV
curl -X POST https://huggingface.co/spaces/Gaston895/aegis001/synthesize \
-H "Content-Type: application/json" \
-d '{"text": "Hello world!", "format": "wav"}' \
--output speech.wav
# Get base64 encoded audio
curl -X POST https://huggingface.co/spaces/Gaston895/aegis001/synthesize \
-H "Content-Type: application/json" \
-d '{"text": "Hello world!", "format": "base64"}'
```
### Python
```python
import requests
import base64
# Synthesize speech
response = requests.post(
"https://huggingface.co/spaces/Gaston895/aegis001/synthesize",
json={
"text": "Hello, this is Soprano TTS!",
"temperature": 0.7,
"format": "base64"
}
)
if response.status_code == 200:
data = response.json()
audio_data = base64.b64decode(data['audio_base64'])
with open('output.wav', 'wb') as f:
f.write(audio_data)
```
### JavaScript
```javascript
const synthesizeText = async (text) => {
const response = await fetch('https://huggingface.co/spaces/Gaston895/aegis001/synthesize', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: text,
format: 'base64'
})
});
const data = await response.json();
return data.audio_base64;
};
```
## Model Information
This space uses the Soprano TTS model from [Gaston895/aegis001](https://huggingface.co/Gaston895/aegis001), which features:
- **Architecture**: Qwen3ForCausalLM
- **Parameters**: 80M
- **Context Length**: 1024 tokens
- **Vocabulary Size**: 8192
- **Audio Quality**: 32kHz sampling rate
- **Optimization**: CPU-optimized for Hugging Face Spaces
## Deployment
The model is automatically downloaded from the Hugging Face repository when the space starts up. No manual model files are needed in the space repository.
## Limitations
- English-only support
- No voice cloning capabilities
- Occasional mispronunciation of uncommon words
- CPU-optimized for Hugging Face Spaces
- Model loading time on first startup (~1-2 minutes)
## License
This project is licensed under the Apache-2.0 license. |