File size: 3,410 Bytes
668a0cb
 
 
 
 
5dfbde0
668a0cb
 
 
 
66b1d91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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