roelvangils commited on
Commit
f287e6e
·
verified ·
1 Parent(s): 75cf701

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +398 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Braille Name Converter
3
- emoji: 🔥
4
  colorFrom: blue
5
- colorTo: gray
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: braille-name-converter
3
+ emoji: 🐳
4
  colorFrom: blue
5
+ colorTo: blue
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,398 @@
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>Braille Name Converter</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
8
+ <style>
9
+ :root {
10
+ --primary: #6C63FF;
11
+ --secondary: #FF6584;
12
+ --dark: #423E7D;
13
+ --light: #F8F9FA;
14
+ --dot-active: #2C3E50;
15
+ --dot-inactive: #e0e0e0;
16
+ }
17
+
18
+ * {
19
+ margin: 0;
20
+ padding: 0;
21
+ box-sizing: border-box;
22
+ }
23
+
24
+ body {
25
+ font-family: 'Poppins', sans-serif;
26
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
27
+ min-height: 100vh;
28
+ display: flex;
29
+ flex-direction: column;
30
+ align-items: center;
31
+ justify-content: center;
32
+ padding: 2rem;
33
+ color: var(--dark);
34
+ }
35
+
36
+ .container {
37
+ background-color: white;
38
+ border-radius: 20px;
39
+ box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
40
+ width: 100%;
41
+ max-width: 800px;
42
+ overflow: hidden;
43
+ }
44
+
45
+ header {
46
+ background: var(--primary);
47
+ color: white;
48
+ padding: 2rem;
49
+ text-align: center;
50
+ }
51
+
52
+ h1 {
53
+ font-weight: 600;
54
+ margin-bottom: 0.5rem;
55
+ }
56
+
57
+ .app-content {
58
+ padding: 2rem;
59
+ }
60
+
61
+ .input-section {
62
+ margin-bottom: 2rem;
63
+ }
64
+
65
+ .input-group {
66
+ display: flex;
67
+ margin-bottom: 1rem;
68
+ }
69
+
70
+ input {
71
+ flex: 1;
72
+ padding: 1rem;
73
+ border: 2px solid #e0e0e0;
74
+ border-radius: 10px 0 0 10px;
75
+ font-size: 1rem;
76
+ transition: all 0.3s;
77
+ }
78
+
79
+ input:focus {
80
+ outline: none;
81
+ border-color: var(--primary);
82
+ }
83
+
84
+ button {
85
+ background-color: var(--primary);
86
+ color: white;
87
+ border: none;
88
+ padding: 0 2rem;
89
+ border-radius: 0 10px 10px 0;
90
+ font-size: 1rem;
91
+ cursor: pointer;
92
+ transition: all 0.3s;
93
+ }
94
+
95
+ button:hover {
96
+ background-color: var(--dark);
97
+ }
98
+
99
+ .result-section {
100
+ background-color: var(--light);
101
+ border-radius: 10px;
102
+ padding: 2rem;
103
+ text-align: center;
104
+ min-height: 200px;
105
+ display: flex;
106
+ flex-direction: column;
107
+ justify-content: center;
108
+ }
109
+
110
+ .braille-container {
111
+ display: flex;
112
+ justify-content: center;
113
+ flex-wrap: wrap;
114
+ gap: 1.5rem;
115
+ margin-top: 1rem;
116
+ }
117
+
118
+ .braille-character {
119
+ width: 50px;
120
+ height: 75px;
121
+ position: relative;
122
+ margin: 0 5px;
123
+ }
124
+
125
+ .braille-grid {
126
+ position: relative;
127
+ width: 100%;
128
+ height: 100%;
129
+ display: grid;
130
+ grid-template-columns: repeat(2, 1fr);
131
+ grid-template-rows: repeat(3, 1fr);
132
+ gap: 5px;
133
+ padding: 5px;
134
+ }
135
+
136
+ .braille-dot-container {
137
+ display: flex;
138
+ justify-content: center;
139
+ align-items: center;
140
+ }
141
+
142
+ .braille-dot {
143
+ width: 16px;
144
+ height: 16px;
145
+ background-color: var(--dot-inactive);
146
+ border-radius: 50%;
147
+ transition: all 0.3s;
148
+ position: relative;
149
+ }
150
+
151
+ .braille-dot.active {
152
+ background-color: var(--dot-active);
153
+ transform: scale(1);
154
+ animation: dot-appear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
155
+ animation-delay: calc(var(--delay) * 0.07s);
156
+ }
157
+
158
+ .braille-dot.active::after {
159
+ content: '';
160
+ position: absolute;
161
+ top: 4px;
162
+ left: 4px;
163
+ width: 8px;
164
+ height: 8px;
165
+ border-radius: 50%;
166
+ background-color: white;
167
+ opacity: 0.5;
168
+ }
169
+
170
+ @keyframes dot-appear {
171
+ 0% {
172
+ transform: scale(0) translateY(20px);
173
+ opacity: 0;
174
+ }
175
+ 50% {
176
+ transform: scale(1.1);
177
+ opacity: 1;
178
+ }
179
+ 100% {
180
+ transform: scale(1);
181
+ opacity: 1;
182
+ }
183
+ }
184
+
185
+ .braille-label {
186
+ position: absolute;
187
+ bottom: -20px;
188
+ left: 0;
189
+ right: 0;
190
+ text-align: center;
191
+ font-size: 0.8rem;
192
+ color: var(--dark);
193
+ opacity: 0;
194
+ animation: fadeIn 0.3s forwards;
195
+ animation-delay: calc(var(--delay) * 0.07s + 0.4s);
196
+ }
197
+
198
+ @keyframes fadeIn {
199
+ from { opacity: 0; transform: translateY(5px); }
200
+ to { opacity: 0.7; transform: translateY(0); }
201
+ }
202
+
203
+ .guide-text {
204
+ margin-top: 2rem;
205
+ font-size: 0.9rem;
206
+ color: #666;
207
+ }
208
+
209
+ footer {
210
+ margin-top: 2rem;
211
+ text-align: center;
212
+ color: #666;
213
+ font-size: 0.8rem;
214
+ }
215
+
216
+ @media (max-width: 600px) {
217
+ .app-content {
218
+ padding: 1.5rem;
219
+ }
220
+
221
+ .braille-character {
222
+ width: 40px;
223
+ height: 60px;
224
+ }
225
+
226
+ .braille-dot {
227
+ width: 12px;
228
+ height: 12px;
229
+ }
230
+ }
231
+ </style>
232
+ </head>
233
+ <body>
234
+ <div class="container">
235
+ <header>
236
+ <h1>Braille Name Converter</h1>
237
+ <p>See your name in the Braille alphabet</p>
238
+ </header>
239
+
240
+ <div class="app-content">
241
+ <div class="input-section">
242
+ <div class="input-group">
243
+ <input type="text" id="nameInput" placeholder="Enter your name" autofocus>
244
+ <button id="convertBtn">Convert</button>
245
+ </div>
246
+ </div>
247
+
248
+ <div class="result-section">
249
+ <p id="resultText">Your name in Braille will appear here</p>
250
+ <div id="brailleOutput" class="braille-container"></div>
251
+ <p class="guide-text">
252
+ Braille represents letters with raised dots that can be read with fingertips.
253
+ Each character uses a 2x3 grid (two columns with three rows each).
254
+ </p>
255
+ </div>
256
+ </div>
257
+ </div>
258
+
259
+ <footer>
260
+ <p>Created with ❤️ for accessibility | Standard English Braille Grade 1</p>
261
+ </footer>
262
+
263
+ <script>
264
+ document.addEventListener('DOMContentLoaded', function() {
265
+ const nameInput = document.getElementById('nameInput');
266
+ const convertBtn = document.getElementById('convertBtn');
267
+ const brailleOutput = document.getElementById('brailleOutput');
268
+ const resultText = document.getElementById('resultText');
269
+
270
+ // Revised Braille patterns with correct dot positions
271
+ // Order: [column1-row1, column2-row1, column1-row2, column2-row2, column1-row3, column2-row3]
272
+ const brailleAlphabet = {
273
+ 'a': [true, false, false, false, false, false],
274
+ 'b': [true, false, true, false, false, false],
275
+ 'c': [true, true, false, false, false, false],
276
+ 'd': [true, true, false, true, false, false],
277
+ 'e': [true, false, false, true, false, false],
278
+ 'f': [true, true, true, false, false, false],
279
+ 'g': [true, true, true, true, false, false],
280
+ 'h': [true, false, true, true, false, false],
281
+ 'i': [false, true, true, false, false, false],
282
+ 'j': [false, true, true, true, false, false],
283
+ 'k': [true, false, false, false, true, false],
284
+ 'l': [true, false, true, false, true, false],
285
+ 'm': [true, true, false, false, true, false],
286
+ 'n': [true, true, false, true, true, false],
287
+ 'o': [true, false, false, true, true, false],
288
+ 'p': [true, true, true, false, true, false],
289
+ 'q': [true, true, true, true, true, false],
290
+ 'r': [true, false, true, true, true, false],
291
+ 's': [false, true, true, false, true, false],
292
+ 't': [false, true, true, true, true, false],
293
+ 'u': [true, false, false, false, true, true],
294
+ 'v': [true, false, true, false, true, true],
295
+ 'w': [false, true, true, true, false, true],
296
+ 'x': [true, true, false, false, true, true],
297
+ 'y': [true, true, false, true, true, true],
298
+ 'z': [true, false, false, true, true, true],
299
+ ' ': [false, false, false, false, false, false],
300
+ '1': [true, false, false, false, false, false], // Numeric indicators would require prefix
301
+ '2': [true, false, true, false, false, false],
302
+ '3': [true, true, false, false, false, false],
303
+ '4': [true, true, false, true, false, false],
304
+ '5': [true, false, false, true, false, false],
305
+ '6': [true, true, true, false, false, false],
306
+ '7': [true, true, true, true, false, false],
307
+ '8': [true, false, true, true, false, false],
308
+ '9': [false, true, true, false, false, false],
309
+ '0': [false, true, true, true, false, false]
310
+ };
311
+
312
+ convertBtn.addEventListener('click', convertToBraille);
313
+ nameInput.addEventListener('keypress', function(e) {
314
+ if (e.key === 'Enter') convertToBraille();
315
+ });
316
+
317
+ function convertToBraille() {
318
+ const name = nameInput.value.trim().toLowerCase();
319
+ if (!name) {
320
+ resultText.textContent = 'Please enter a name to convert';
321
+ brailleOutput.innerHTML = '';
322
+ return;
323
+ }
324
+
325
+ resultText.textContent = `"${name}" in Braille:`;
326
+ brailleOutput.innerHTML = '';
327
+
328
+ let delayCounter = 0;
329
+
330
+ for (let i = 0; i < name.length; i++) {
331
+ const char = name[i];
332
+ if (brailleAlphabet[char]) {
333
+ createBrailleCharacter(char, delayCounter);
334
+ delayCounter += 6; // each character has 6 possible dots
335
+ } else {
336
+ // Handle unknown characters
337
+ createBrailleCharacter('?', delayCounter);
338
+ delayCounter += 6;
339
+ }
340
+ }
341
+ }
342
+
343
+ function createBrailleCharacter(char, startDelay) {
344
+ const pattern = brailleAlphabet[char] || brailleAlphabet[' '];
345
+ const charContainer = document.createElement('div');
346
+ charContainer.className = 'braille-character';
347
+
348
+ const grid = document.createElement('div');
349
+ grid.className = 'braille-grid';
350
+ charContainer.appendChild(grid);
351
+
352
+ // Create the 2x3 grid of dots
353
+ for (let i = 0; i < 6; i++) {
354
+ const dotContainer = document.createElement('div');
355
+ dotContainer.className = 'braille-dot-container';
356
+
357
+ const dot = document.createElement('div');
358
+ dot.className = 'braille-dot';
359
+
360
+ if (pattern[i]) {
361
+ dot.classList.add('active');
362
+ dot.style.setProperty('--delay', startDelay + i);
363
+ }
364
+
365
+ dotContainer.appendChild(dot);
366
+ grid.appendChild(dotContainer);
367
+ }
368
+
369
+ // Add character label
370
+ const label = document.createElement('div');
371
+ label.className = 'braille-label';
372
+ label.textContent = char === ' ' ? 'space' : char.toUpperCase();
373
+ label.style.setProperty('--delay', startDelay);
374
+ charContainer.appendChild(label);
375
+
376
+ brailleOutput.appendChild(charContainer);
377
+ }
378
+
379
+ // Initial animation for welcome message
380
+ setTimeout(() => {
381
+ const sample = "hello";
382
+ resultText.textContent = `"${sample}" in Braille:`;
383
+ brailleOutput.innerHTML = '';
384
+
385
+ for (let i = 0; i < sample.length; i++) {
386
+ createBrailleCharacter(sample[i], i * 6);
387
+ }
388
+
389
+ // Reset after demo
390
+ setTimeout(() => {
391
+ resultText.textContent = 'Your name in Braille will appear here';
392
+ brailleOutput.innerHTML = '';
393
+ }, 3000);
394
+ }, 1000);
395
+ });
396
+ </script>
397
+ <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 <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body>
398
+ </html>