Hameed13 commited on
Commit
3f6fb88
·
verified ·
1 Parent(s): 411b835

Create readme.md

Browse files
Files changed (1) hide show
  1. readme.md +84 -0
readme.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Nigerian Text-to-Speech API
2
+ 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.
3
+ Features
4
+
5
+ Convert text to Nigerian-accented speech
6
+ Multiple voices and languages
7
+ REST API endpoints
8
+ Base64 encoded audio output
9
+ Simple file-based output
10
+
11
+ API Endpoints
12
+ Health Check
13
+
14
+ URL: /
15
+ Method: GET
16
+ Response: Information about the API status and available voices/languages
17
+
18
+ Text-to-Speech
19
+
20
+ URL: /tts
21
+ Method: POST
22
+ Body:
23
+ json{
24
+ "text": "Your text to convert to speech",
25
+ "language": "english",
26
+ "voice": "idera",
27
+ "speed": 1.0
28
+ }
29
+
30
+ Response: JSON object with base64-encoded audio and audio URL
31
+
32
+ Get Audio File
33
+
34
+ URL: /audio/{filename}
35
+ Method: GET
36
+ Response: Audio file (WAV format)
37
+
38
+ Usage Examples
39
+ cURL Example
40
+ bashcurl -X POST "https://yourdomain.com/tts" \
41
+ -H "Content-Type: application/json" \
42
+ -d '{"text":"Welcome to Nigeria, the giant of Africa.", "language":"english", "voice":"idera"}'
43
+ Python Example
44
+ pythonimport requests
45
+ import base64
46
+ import io
47
+ from IPython.display import Audio
48
+
49
+ response = requests.post(
50
+ "https://yourdomain.com/tts",
51
+ json={
52
+ "text": "Welcome to Nigeria, the giant of Africa.",
53
+ "language": "english",
54
+ "voice": "idera",
55
+ "speed": 1.0
56
+ }
57
+ )
58
+
59
+ data = response.json()
60
+ audio_data = base64.b64decode(data["audio_base64"])
61
+ Audio(audio_data, rate=24000)
62
+ Available Voices and Languages
63
+ Voices
64
+
65
+ Female: zainab, idera, regina, chinenye, joke, remi
66
+ Male: jude, tayo, umar, osagie, onye, emma
67
+
68
+ Languages
69
+
70
+ english
71
+ yoruba
72
+ igbo
73
+ hausa
74
+
75
+ Configuration
76
+ The API uses the following YarnGPT model:
77
+
78
+ Model: yarngpt/yarn-tts-demo
79
+
80
+ Deployment
81
+ This API is designed to run on Hugging Face Spaces with the following configuration:
82
+
83
+ SDK: Docker
84
+ Hardware: CPU (recommended: GPU for better performance)