hissain commited on
Commit
8535419
·
verified ·
1 Parent(s): 17982eb

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +343 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Bengaltts
3
- emoji: 📚
4
- colorFrom: blue
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: bengaltts
3
+ emoji: 🐳
4
+ colorFrom: purple
5
+ colorTo: yellow
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,343 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>বাংলা বক্তৃতা সংশ্লেষণ | Bengali Speech Synthesis</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&display=swap');
11
+
12
+ body {
13
+ font-family: 'Hind Siliguri', sans-serif;
14
+ background-color: #f8fafc;
15
+ }
16
+
17
+ .waveform {
18
+ background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
19
+ height: 60px;
20
+ width: 100%;
21
+ border-radius: 8px;
22
+ position: relative;
23
+ overflow: hidden;
24
+ }
25
+
26
+ .waveform::after {
27
+ content: '';
28
+ position: absolute;
29
+ top: 0;
30
+ left: 0;
31
+ right: 0;
32
+ bottom: 0;
33
+ background: linear-gradient(90deg,
34
+ rgba(255,255,255,0.2) 0%,
35
+ rgba(255,255,255,0.1) 50%,
36
+ rgba(255,255,255,0.2) 100%);
37
+ animation: wave 2s linear infinite;
38
+ background-size: 200% 100%;
39
+ }
40
+
41
+ @keyframes wave {
42
+ 0% {
43
+ background-position: 0% 50%;
44
+ }
45
+ 100% {
46
+ background-position: 200% 50%;
47
+ }
48
+ }
49
+
50
+ .bengali-text {
51
+ line-height: 1.8;
52
+ font-size: 1.1rem;
53
+ }
54
+
55
+ .voice-option:hover {
56
+ transform: translateY(-2px);
57
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
58
+ }
59
+ </style>
60
+ </head>
61
+ <body class="min-h-screen bg-gray-50">
62
+ <div class="container mx-auto px-4 py-8 max-w-4xl">
63
+ <!-- Header -->
64
+ <header class="mb-8 text-center">
65
+ <h1 class="text-4xl font-bold text-indigo-800 mb-2">বাংলা বক্তৃতা সংশ্লেষণ</h1>
66
+ <p class="text-lg text-gray-600">Text-to-Speech for Bengali Language</p>
67
+ <div class="waveform mt-4"></div>
68
+ </header>
69
+
70
+ <!-- Main Content -->
71
+ <main>
72
+ <!-- Text Input Section -->
73
+ <section class="mb-8 bg-white rounded-xl shadow-md overflow-hidden">
74
+ <div class="p-6">
75
+ <h2 class="text-2xl font-semibold text-gray-800 mb-4">আপনার পাঠ্য লিখুন</h2>
76
+ <div class="mb-4">
77
+ <textarea id="text-input" rows="6" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 bengali-text" placeholder="এখানে বাংলা লেখা লিখুন..."></textarea>
78
+ </div>
79
+ <div class="flex flex-wrap gap-3">
80
+ <button id="speak-btn" class="flex items-center px-6 py-3 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors">
81
+ <i class="fas fa-play mr-2"></i> পাঠ করুন
82
+ </button>
83
+ <button id="pause-btn" class="flex items-center px-6 py-3 bg-amber-500 text-white rounded-lg hover:bg-amber-600 transition-colors">
84
+ <i class="fas fa-pause mr-2"></i> বিরতি
85
+ </button>
86
+ <button id="resume-btn" class="flex items-center px-6 py-3 bg-emerald-500 text-white rounded-lg hover:bg-emerald-600 transition-colors">
87
+ <i class="fas fa-redo mr-2"></i> পুনরায় শুরু
88
+ </button>
89
+ <button id="stop-btn" class="flex items-center px-6 py-3 bg-rose-500 text-white rounded-lg hover:bg-rose-600 transition-colors">
90
+ <i class="fas fa-stop mr-2"></i> বন্ধ করুন
91
+ </button>
92
+ </div>
93
+ </div>
94
+ </section>
95
+
96
+ <!-- Voice Settings -->
97
+ <section class="mb-8 bg-white rounded-xl shadow-md overflow-hidden">
98
+ <div class="p-6">
99
+ <h2 class="text-2xl font-semibold text-gray-800 mb-4">কণ্ঠস্বর সেটিংস</h2>
100
+
101
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
102
+ <div>
103
+ <label for="voice-select" class="block text-sm font-medium text-gray-700 mb-1">কণ্ঠস্বর নির্বাচন</label>
104
+ <select id="voice-select" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500">
105
+ <option value="">স্বয়ংক্রিয় নির্বাচন</option>
106
+ </select>
107
+ </div>
108
+ <div>
109
+ <label for="rate-select" class="block text-sm font-medium text-gray-700 mb-1">গতি</label>
110
+ <input type="range" id="rate-select" min="0.5" max="2" step="0.1" value="1" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
111
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
112
+ <span>ধীর</span>
113
+ <span id="rate-value">স্বাভাবিক</span>
114
+ <span>দ্রুত</span>
115
+ </div>
116
+ </div>
117
+ </div>
118
+
119
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
120
+ <div>
121
+ <label for="pitch-select" class="block text-sm font-medium text-gray-700 mb-1">সুর</label>
122
+ <input type="range" id="pitch-select" min="0.5" max="2" step="0.1" value="1" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
123
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
124
+ <span>নিম্ন</span>
125
+ <span id="pitch-value">স্বাভাবিক</span>
126
+ <span>উচ্চ</span>
127
+ </div>
128
+ </div>
129
+ <div>
130
+ <label for="volume-select" class="block text-sm font-medium text-gray-700 mb-1">ভলিউম</label>
131
+ <input type="range" id="volume-select" min="0" max="1" step="0.1" value="1" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer">
132
+ <div class="flex justify-between text-xs text-gray-500 mt-1">
133
+ <span>নিম্ন</span>
134
+ <span id="volume-value">উচ্চ</span>
135
+ </div>
136
+ </div>
137
+ </div>
138
+ </div>
139
+ </section>
140
+
141
+ <!-- Sample Texts -->
142
+ <section class="mb-8 bg-white rounded-xl shadow-md overflow-hidden">
143
+ <div class="p-6">
144
+ <h2 class="text-2xl font-semibold text-gray-800 mb-4">নমুনা পাঠ্য</h2>
145
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
146
+ <button class="voice-option p-4 border border-gray-200 rounded-lg hover:bg-indigo-50 transition-all" onclick="setSampleText(1)">
147
+ <h3 class="font-medium text-indigo-700">সাধারণ বাক্য</h3>
148
+ <p class="text-sm text-gray-600 mt-1 bengali-text">আমার সোনার বাংলা, আমি তোমায় ভালোবাসি।</p>
149
+ </button>
150
+ <button class="voice-option p-4 border border-gray-200 rounded-lg hover:bg-indigo-50 transition-all" onclick="setSampleText(2)">
151
+ <h3 class="font-medium text-indigo-700">প্রাত্যহিক কথোপকথন</h3>
152
+ <p class="text-sm text-gray-600 mt-1 bengali-text">আপনি কেমন আছেন? আজকের আবহাওয়া খুব সুন্দর।</p>
153
+ </button>
154
+ <button class="voice-option p-4 border border-gray-200 rounded-lg hover:bg-indigo-50 transition-all" onclick="setSampleText(3)">
155
+ <h3 class="font-medium text-indigo-700">সংবাদ শিরোনাম</h3>
156
+ <p class="text-sm text-gray-600 mt-1 bengali-text">আজ ঢাকায় আন্তর্জাতিক বইমেলা শুরু হয়েছে।</p>
157
+ </button>
158
+ <button class="voice-option p-4 border border-gray-200 rounded-lg hover:bg-indigo-50 transition-all" onclick="setSampleText(4)">
159
+ <h3 class="font-medium text-indigo-700">কবিতা</h3>
160
+ <p class="text-sm text-gray-600 mt-1 bengali-text">চাঁদনী রাতে যদি তুমি আসো, ফুলের গন্ধে ভেসে আসো।</p>
161
+ </button>
162
+ </div>
163
+ </div>
164
+ </section>
165
+ </main>
166
+
167
+ <!-- Footer -->
168
+ <footer class="mt-12 text-center text-gray-500 text-sm">
169
+ <p>বাংলা বক্তৃতা সংশ্লেষণ অ্যাপ্লিকেশন | তৈরি করেছেন আপনার নাম</p>
170
+ <p class="mt-1">ওয়েব স্পিচ API ব্যবহার করে</p>
171
+ </footer>
172
+ </div>
173
+
174
+ <script>
175
+ document.addEventListener('DOMContentLoaded', function() {
176
+ // Speech synthesis setup
177
+ const synth = window.speechSynthesis;
178
+ let utterance = null;
179
+ let voices = [];
180
+
181
+ // DOM elements
182
+ const textInput = document.getElementById('text-input');
183
+ const speakBtn = document.getElementById('speak-btn');
184
+ const pauseBtn = document.getElementById('pause-btn');
185
+ const resumeBtn = document.getElementById('resume-btn');
186
+ const stopBtn = document.getElementById('stop-btn');
187
+ const voiceSelect = document.getElementById('voice-select');
188
+ const rateSelect = document.getElementById('rate-select');
189
+ const pitchSelect = document.getElementById('pitch-select');
190
+ const volumeSelect = document.getElementById('volume-select');
191
+ const rateValue = document.getElementById('rate-value');
192
+ const pitchValue = document.getElementById('pitch-value');
193
+ const volumeValue = document.getElementById('volume-value');
194
+
195
+ // Load voices
196
+ function loadVoices() {
197
+ voices = synth.getVoices();
198
+ voiceSelect.innerHTML = '<option value="">স্বয়ংক্রিয় নির্বাচন</option>';
199
+
200
+ // Filter Bengali voices if available
201
+ const bengaliVoices = voices.filter(voice =>
202
+ voice.lang.includes('bn') || voice.lang.includes('bn-') || voice.name.includes('Bengali')
203
+ );
204
+
205
+ // Add Bengali voices first
206
+ bengaliVoices.forEach(voice => {
207
+ const option = document.createElement('option');
208
+ option.textContent = `${voice.name} (${voice.lang})`;
209
+ option.setAttribute('data-name', voice.name);
210
+ voiceSelect.appendChild(option);
211
+ });
212
+
213
+ // Add other voices
214
+ voices.forEach(voice => {
215
+ if (!bengaliVoices.includes(voice)) {
216
+ const option = document.createElement('option');
217
+ option.textContent = `${voice.name} (${voice.lang})`;
218
+ option.setAttribute('data-name', voice.name);
219
+ voiceSelect.appendChild(option);
220
+ }
221
+ });
222
+ }
223
+
224
+ // Chrome needs this
225
+ if (speechSynthesis.onvoiceschanged !== undefined) {
226
+ speechSynthesis.onvoiceschanged = loadVoices;
227
+ }
228
+
229
+ // Initialize voices
230
+ loadVoices();
231
+
232
+ // Speak function
233
+ function speak() {
234
+ if (synth.speaking) {
235
+ console.error('Already speaking...');
236
+ return;
237
+ }
238
+
239
+ if (textInput.value !== '') {
240
+ utterance = new SpeechSynthesisUtterance(textInput.value);
241
+
242
+ // Set voice if selected
243
+ const selectedVoice = voiceSelect.selectedOptions[0]?.getAttribute('data-name');
244
+ if (selectedVoice) {
245
+ utterance.voice = voices.find(voice => voice.name === selectedVoice);
246
+ }
247
+
248
+ // Set parameters
249
+ utterance.rate = rateSelect.value;
250
+ utterance.pitch = pitchSelect.value;
251
+ utterance.volume = volumeSelect.value;
252
+
253
+ // Speak
254
+ synth.speak(utterance);
255
+
256
+ // Update UI
257
+ speakBtn.disabled = true;
258
+ stopBtn.disabled = false;
259
+ pauseBtn.disabled = false;
260
+ resumeBtn.disabled = true;
261
+
262
+ // When finished
263
+ utterance.onend = function() {
264
+ speakBtn.disabled = false;
265
+ stopBtn.disabled = true;
266
+ pauseBtn.disabled = true;
267
+ resumeBtn.disabled = true;
268
+ };
269
+ }
270
+ }
271
+
272
+ // Event listeners
273
+ speakBtn.addEventListener('click', speak);
274
+
275
+ pauseBtn.addEventListener('click', function() {
276
+ synth.pause();
277
+ pauseBtn.disabled = true;
278
+ resumeBtn.disabled = false;
279
+ });
280
+
281
+ resumeBtn.addEventListener('click', function() {
282
+ synth.resume();
283
+ pauseBtn.disabled = false;
284
+ resumeBtn.disabled = true;
285
+ });
286
+
287
+ stopBtn.addEventListener('click', function() {
288
+ synth.cancel();
289
+ speakBtn.disabled = false;
290
+ stopBtn.disabled = true;
291
+ pauseBtn.disabled = true;
292
+ resumeBtn.disabled = true;
293
+ });
294
+
295
+ // Update rate value display
296
+ rateSelect.addEventListener('input', function() {
297
+ const rate = parseFloat(rateSelect.value);
298
+ if (rate < 0.8) {
299
+ rateValue.textContent = 'ধীর';
300
+ } else if (rate > 1.2) {
301
+ rateValue.textContent = 'দ্রুত';
302
+ } else {
303
+ rateValue.textContent = 'স্বাভাবিক';
304
+ }
305
+ });
306
+
307
+ // Update pitch value display
308
+ pitchSelect.addEventListener('input', function() {
309
+ const pitch = parseFloat(pitchSelect.value);
310
+ if (pitch < 0.8) {
311
+ pitchValue.textContent = 'নিম্ন';
312
+ } else if (pitch > 1.2) {
313
+ pitchValue.textContent = 'উচ্চ';
314
+ } else {
315
+ pitchValue.textContent = 'স্বাভাবিক';
316
+ }
317
+ });
318
+
319
+ // Update volume value display
320
+ volumeSelect.addEventListener('input', function() {
321
+ const volume = parseFloat(volumeSelect.value);
322
+ if (volume < 0.5) {
323
+ volumeValue.textContent = 'নিম্ন';
324
+ } else {
325
+ volumeValue.textContent = 'উচ্চ';
326
+ }
327
+ });
328
+ });
329
+
330
+ // Set sample text
331
+ function setSampleText(type) {
332
+ const texts = {
333
+ 1: 'আমার সোনার বাংলা, আমি তোমায় ভালোবাসি। চিরদিন তোমার আকাশ, তোমার বাতাস, আমার প্রাণে বাজায় বাঁশি।',
334
+ 2: 'আপনি কেমন আছেন? আজকের আবহাওয়া খুব সুন্দর। আপনি কি আমার সাথে এক কাপ চা পান করতে চান?',
335
+ 3: 'আজ ঢাকায় আন্তর্জাতিক বইমেলা শুরু হয়েছে। প্রধানমন্ত্রী শেখ হাসিনা মেলার উদ্বোধন করেছেন।',
336
+ 4: 'চাঁদনী রাতে যদি তুমি আসো, ফুলের গন্ধে ভেসে আসো। নদীর জলে আলোয় যদি, তোমার মুখ দেখি আমি হাসো।'
337
+ };
338
+
339
+ document.getElementById('text-input').value = texts[type];
340
+ }
341
+ </script>
342
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=hissain/bengaltts" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
343
+ </html>