File size: 1,826 Bytes
3f6fb88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
Nigerian Text-to-Speech API
This is a API service that converts text to speech with authentic Nigerian accents. The API is built with FastAPI and uses the YarnGPT text-to-speech model.
Features

Convert text to Nigerian-accented speech
Multiple voices and languages
REST API endpoints
Base64 encoded audio output
Simple file-based output

API Endpoints
Health Check

URL: /
Method: GET
Response: Information about the API status and available voices/languages

Text-to-Speech

URL: /tts
Method: POST
Body:
json{
  "text": "Your text to convert to speech",
  "language": "english",
  "voice": "idera",
  "speed": 1.0
}

Response: JSON object with base64-encoded audio and audio URL

Get Audio File

URL: /audio/{filename}
Method: GET
Response: Audio file (WAV format)

Usage Examples
cURL Example
bashcurl -X POST "https://yourdomain.com/tts" \
  -H "Content-Type: application/json" \
  -d '{"text":"Welcome to Nigeria, the giant of Africa.", "language":"english", "voice":"idera"}'
Python Example
pythonimport requests
import base64
import io
from IPython.display import Audio

response = requests.post(
    "https://yourdomain.com/tts",
    json={
        "text": "Welcome to Nigeria, the giant of Africa.",
        "language": "english",
        "voice": "idera",
        "speed": 1.0
    }
)

data = response.json()
audio_data = base64.b64decode(data["audio_base64"])
Audio(audio_data, rate=24000)
Available Voices and Languages
Voices

Female: zainab, idera, regina, chinenye, joke, remi
Male: jude, tayo, umar, osagie, onye, emma

Languages

english
yoruba
igbo
hausa

Configuration
The API uses the following YarnGPT model:

Model: yarngpt/yarn-tts-demo

Deployment
This API is designed to run on Hugging Face Spaces with the following configuration:

SDK: Docker
Hardware: CPU (recommended: GPU for better performance)