hexatts / README.md
Hexa06's picture
Remove Gradio UI, keep FastAPI endpoints only
5dfbde0
---
title: Kokoro TTS API - Professional & Fast
emoji: 🎀
colorFrom: blue
colorTo: purple
sdk: docker
app_file: app.py
pinned: false
---
# Kokoro TTS Service - Professional & Lightning Fast ⚑
**10x faster than XTTS** | Emotional voices for storytelling | CPU-optimized
## πŸš€ Why Kokoro?
- ⚑ **Lightning Fast**: Generates audio in real-time on CPU
- 🎭 **Emotional Expression**: Perfect for audiobooks & storytelling
- πŸ’Ύ **Lightweight**: Only 82M parameters (vs XTTS 400M+)
- πŸ”’ **Secure**: Supabase authentication with user management
- πŸ“Š **High Quota**: 50 generations/day (vs 3 with XTTS)
## πŸ” Admin Credentials
```
Username: madhab
Password: Madhab@Studify2024!
```
## πŸ“¦ Setup
### 1. Supabase Database
Run `supabase_schema.sql` in your Supabase SQL Editor
### 2. Install & Run
```bash
pip install -r requirements.txt
python app.py
```
## 🎀 Available Voices
| Voice | Description | Best For |
|-------|-------------|----------|
| `af_heart` | American Female (warm) | General narration |
| `af_bella` | American Female (professional) | Educational content |
| `am_adam` | American Male (confident) | Business/Tech |
| `am_michael` | American Male (friendly) | Casual/Conversational |
| `bf_emma` | British Female (elegant) | Formal content |
| `bf_isabella` | British Female (storytelling) | **Audiobooks/Stories** ⭐ |
## πŸ“‘ API Usage
### Generate Speech (Fast!)
```bash
curl -X POST http://localhost:7860/api/generate \
-F "username=madhab" \
-F "password=Madhab@Studify2024!" \
-F "text=The concept of artificial intelligence has evolved significantly over the past few decades." \
-F "voice=bf_isabella" \
-F "speed=1.0" \
--output output.wav
```
### Check Quota
```bash
curl -X POST http://localhost:7860/api/quota \
-F "username=madhab" \
-F "password=Madhab@Studify2024!"
```
### Create New User (Admin)
```bash
curl -X POST http://localhost:7860/api/admin/create-user \
-F "admin_username=madhab" \
-F "admin_password=Madhab@Studify2024!" \
-F "new_username=student" \
-F "new_password=SecurePass123!" \
-F "role=user" \
-F "daily_limit=50"
```
## ⚑ Performance Comparison
| Model | Speed | Quality | CPU Usage | Max Chars |
|-------|-------|---------|-----------|-----------|
| **Kokoro** | **10x** | High | Low | 5000 |
| XTTS v2 | 1x | Very High | High | 3000 |
| Bark | 0.5x | High | Very High | 1000 |
## 🎯 Perfect For
- βœ… Long-form educational content
- βœ… Audiobook narration
- βœ… Real-time reader mode in apps
- βœ… Storytelling with emotion
- βœ… Multi-voice projects
## πŸ”§ Integration Example (Flutter)
Update your `AIService.dart`:
```dart
final response = await http.post(
Uri.parse('https://your-space.hf.space/api/generate'),
headers: {'Content-Type': 'multipart/form-data'},
body: {
'username': 'your_username',
'password': 'your_password',
'text': text,
'voice': 'bf_isabella', // Storytelling voice
'speed': '1.0'
}
);
```
## πŸ“Š Quota System
| Role | Daily Limit | Speed Limit |
|------|-------------|-------------|
| User | 50 generations | Normal |
| Premium | Custom | Priority |
| Admin | Unlimited | Highest |
## 🌐 Deploy to Hugging Face
1. Push to GitHub
2. Create new Space on Hugging Face
3. Set secrets: `SUPABASE_URL`, `SUPABASE_KEY`
4. Deploy!
---
**Built for [Studify](https://github.com/your-repo)** - Making education accessible through AI