privateuserh commited on
Commit
b457ce6
·
verified ·
1 Parent(s): acdd3b8

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +1035 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Ai Avatar V1 02
3
- emoji: 📚
4
- colorFrom: gray
5
- colorTo: indigo
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: ai-avatar-v1-02
3
+ emoji: 🐳
4
+ colorFrom: red
5
+ colorTo: gray
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,1035 @@
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>AI Video Avatar - Your Digital Guide</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=Poppins:wght@300;400;500;600;700&display=swap');
11
+
12
+ :root {
13
+ --primary: #3b82f6;
14
+ --primary-dark: #2563eb;
15
+ --secondary: #f43f5e;
16
+ }
17
+
18
+ body {
19
+ font-family: 'Poppins', sans-serif;
20
+ background: #0f172a;
21
+ color: white;
22
+ overflow: hidden;
23
+ height: 100vh;
24
+ }
25
+
26
+ .video-container {
27
+ position: fixed;
28
+ top: 0;
29
+ left: 0;
30
+ width: 100%;
31
+ height: 100%;
32
+ z-index: 0;
33
+ overflow: hidden;
34
+ }
35
+
36
+ .video-placeholder {
37
+ position: absolute;
38
+ top: 0;
39
+ left: 0;
40
+ width: 100%;
41
+ height: 100%;
42
+ object-fit: cover;
43
+ background-color: #1e293b;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ }
48
+
49
+ .video-placeholder img {
50
+ max-width: 100%;
51
+ max-height: 100%;
52
+ object-fit: contain;
53
+ }
54
+
55
+ .video-overlay {
56
+ position: absolute;
57
+ top: 0;
58
+ left: 0;
59
+ width: 100%;
60
+ height: 100%;
61
+ background: linear-gradient(to bottom, rgba(15, 23, 42, 0.2) 0%, rgba(15, 23, 42, 0.7) 100%);
62
+ z-index: 1;
63
+ }
64
+
65
+ .content-container {
66
+ position: relative;
67
+ z-index: 2;
68
+ height: 100vh;
69
+ display: flex;
70
+ flex-direction: column;
71
+ justify-content: flex-end;
72
+ padding-bottom: 120px;
73
+ }
74
+
75
+ .speech-bubble {
76
+ position: relative;
77
+ background: rgba(30, 41, 59, 0.9);
78
+ border-radius: 1rem;
79
+ animation: pulse 2s infinite;
80
+ max-width: 800px;
81
+ margin: 0 auto;
82
+ }
83
+
84
+ .speech-bubble:after {
85
+ content: '';
86
+ position: absolute;
87
+ bottom: -10px;
88
+ left: 50px;
89
+ border-width: 10px 10px 0;
90
+ border-style: solid;
91
+ border-color: rgba(30, 41, 59, 0.9) transparent;
92
+ }
93
+
94
+ @keyframes pulse {
95
+ 0% {
96
+ box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
97
+ }
98
+ 70% {
99
+ box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
100
+ }
101
+ 100% {
102
+ box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
103
+ }
104
+ }
105
+
106
+ .typing-indicator span {
107
+ display: inline-block;
108
+ width: 8px;
109
+ height: 8px;
110
+ border-radius: 50%;
111
+ background: white;
112
+ margin: 0 2px;
113
+ opacity: 0.4;
114
+ }
115
+
116
+ .typing-indicator span:nth-child(1) {
117
+ animation: typing 1s infinite;
118
+ }
119
+
120
+ .typing-indicator span:nth-child(2) {
121
+ animation: typing 1s infinite 0.2s;
122
+ }
123
+
124
+ .typing-indicator span:nth-child(3) {
125
+ animation: typing 1s infinite 0.4s;
126
+ }
127
+
128
+ @keyframes typing {
129
+ 0% {
130
+ opacity: 0.4;
131
+ transform: translateY(0);
132
+ }
133
+ 50% {
134
+ opacity: 1;
135
+ transform: translateY(-5px);
136
+ }
137
+ 100% {
138
+ opacity: 0.4;
139
+ transform: translateY(0);
140
+ }
141
+ }
142
+
143
+ .lip-sync {
144
+ animation: lip-sync 0.5s infinite alternate;
145
+ }
146
+
147
+ @keyframes lip-sync {
148
+ 0% {
149
+ transform: scaleY(1);
150
+ }
151
+ 100% {
152
+ transform: scaleY(0.8);
153
+ }
154
+ }
155
+
156
+ .news-card {
157
+ background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
158
+ backdrop-filter: blur(10px);
159
+ transition: all 0.3s ease;
160
+ }
161
+
162
+ .news-card:hover {
163
+ transform: translateY(-5px);
164
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
165
+ }
166
+
167
+ .social-icon {
168
+ transition: all 0.3s ease;
169
+ }
170
+
171
+ .social-icon:hover {
172
+ transform: scale(1.2);
173
+ }
174
+
175
+ .upload-btn {
176
+ position: absolute;
177
+ top: 20px;
178
+ right: 20px;
179
+ z-index: 10;
180
+ background: rgba(30, 41, 59, 0.8);
181
+ border: 1px solid #3b82f6;
182
+ color: white;
183
+ padding: 8px 16px;
184
+ border-radius: 8px;
185
+ cursor: pointer;
186
+ transition: all 0.3s ease;
187
+ }
188
+
189
+ .upload-btn:hover {
190
+ background: rgba(59, 130, 246, 0.8);
191
+ }
192
+
193
+ #file-input {
194
+ display: none;
195
+ }
196
+
197
+ .upload-icon {
198
+ margin-right: 8px;
199
+ }
200
+
201
+ .avatar-placeholder-text {
202
+ color: rgba(255, 255, 255, 0.5);
203
+ font-size: 1.2rem;
204
+ text-align: center;
205
+ padding: 20px;
206
+ }
207
+
208
+ /* Floating action button styles */
209
+ .fab-container {
210
+ position: fixed;
211
+ bottom: 30px;
212
+ right: 30px;
213
+ z-index: 100;
214
+ display: flex;
215
+ flex-direction: column;
216
+ align-items: flex-end;
217
+ }
218
+
219
+ .fab-main {
220
+ width: 60px;
221
+ height: 60px;
222
+ border-radius: 50%;
223
+ background: linear-gradient(135deg, #3b82f6, #2563eb);
224
+ color: white;
225
+ display: flex;
226
+ align-items: center;
227
+ justify-content: center;
228
+ font-size: 24px;
229
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
230
+ cursor: pointer;
231
+ transition: all 0.3s ease;
232
+ z-index: 101;
233
+ }
234
+
235
+ .fab-main:hover {
236
+ transform: scale(1.1);
237
+ box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
238
+ }
239
+
240
+ .fab-menu {
241
+ position: absolute;
242
+ bottom: 70px;
243
+ right: 0;
244
+ width: 300px;
245
+ background: rgba(30, 41, 59, 0.95);
246
+ border-radius: 16px;
247
+ padding: 20px;
248
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
249
+ transform: translateY(20px);
250
+ opacity: 0;
251
+ pointer-events: none;
252
+ transition: all 0.3s ease;
253
+ backdrop-filter: blur(10px);
254
+ }
255
+
256
+ .fab-menu.active {
257
+ transform: translateY(0);
258
+ opacity: 1;
259
+ pointer-events: all;
260
+ }
261
+
262
+ .fab-menu-header {
263
+ display: flex;
264
+ justify-content: space-between;
265
+ align-items: center;
266
+ margin-bottom: 15px;
267
+ }
268
+
269
+ .fab-menu-title {
270
+ font-weight: 600;
271
+ color: #3b82f6;
272
+ }
273
+
274
+ .fab-close-btn {
275
+ background: none;
276
+ border: none;
277
+ color: rgba(255, 255, 255, 0.5);
278
+ font-size: 20px;
279
+ cursor: pointer;
280
+ transition: all 0.2s ease;
281
+ }
282
+
283
+ .fab-close-btn:hover {
284
+ color: white;
285
+ }
286
+
287
+ .fab-menu-content {
288
+ max-height: 400px;
289
+ overflow-y: auto;
290
+ }
291
+
292
+ .fab-menu-tabs {
293
+ display: flex;
294
+ margin-bottom: 15px;
295
+ border-bottom: 1px solid rgba(255, 255, 255, 0.1);
296
+ }
297
+
298
+ .fab-tab {
299
+ padding: 8px 16px;
300
+ cursor: pointer;
301
+ color: rgba(255, 255, 255, 0.6);
302
+ font-size: 14px;
303
+ transition: all 0.2s ease;
304
+ border-bottom: 2px solid transparent;
305
+ }
306
+
307
+ .fab-tab.active {
308
+ color: white;
309
+ border-bottom: 2px solid #3b82f6;
310
+ }
311
+
312
+ .fab-tab:hover {
313
+ color: white;
314
+ }
315
+
316
+ .fab-tab-content {
317
+ display: none;
318
+ }
319
+
320
+ .fab-tab-content.active {
321
+ display: block;
322
+ }
323
+
324
+ .fab-chat-input {
325
+ display: flex;
326
+ gap: 10px;
327
+ margin-top: 15px;
328
+ }
329
+
330
+ .fab-chat-input input {
331
+ flex: 1;
332
+ background: rgba(15, 23, 42, 0.7);
333
+ border: 1px solid rgba(255, 255, 255, 0.1);
334
+ border-radius: 8px;
335
+ padding: 10px 15px;
336
+ color: white;
337
+ outline: none;
338
+ }
339
+
340
+ .fab-chat-input button {
341
+ background: #3b82f6;
342
+ color: white;
343
+ border: none;
344
+ border-radius: 8px;
345
+ padding: 0 15px;
346
+ cursor: pointer;
347
+ transition: all 0.2s ease;
348
+ }
349
+
350
+ .fab-chat-input button:hover {
351
+ background: #2563eb;
352
+ }
353
+
354
+ /* TTS Button Styles */
355
+ .tts-container {
356
+ position: fixed;
357
+ bottom: 30px;
358
+ right: 100px;
359
+ z-index: 100;
360
+ display: flex;
361
+ flex-direction: column;
362
+ align-items: flex-end;
363
+ }
364
+
365
+ .tts-button {
366
+ width: 60px;
367
+ height: 60px;
368
+ border-radius: 50%;
369
+ background: linear-gradient(135deg, #f43f5e, #e11d48);
370
+ color: white;
371
+ display: flex;
372
+ align-items: center;
373
+ justify-content: center;
374
+ font-size: 24px;
375
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
376
+ cursor: pointer;
377
+ transition: all 0.3s ease;
378
+ z-index: 101;
379
+ border: none;
380
+ outline: none;
381
+ }
382
+
383
+ .tts-button:hover {
384
+ transform: scale(1.1);
385
+ box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
386
+ }
387
+
388
+ .tts-button.listening {
389
+ animation: pulse-red 1.5s infinite;
390
+ }
391
+
392
+ .tts-panel {
393
+ position: absolute;
394
+ bottom: 70px;
395
+ right: 0;
396
+ width: 300px;
397
+ background: rgba(30, 41, 59, 0.95);
398
+ border-radius: 16px;
399
+ padding: 20px;
400
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
401
+ transform: translateY(20px);
402
+ opacity: 0;
403
+ pointer-events: none;
404
+ transition: all 0.3s ease;
405
+ backdrop-filter: blur(10px);
406
+ }
407
+
408
+ .tts-panel.active {
409
+ transform: translateY(0);
410
+ opacity: 1;
411
+ pointer-events: all;
412
+ }
413
+
414
+ .tts-header {
415
+ display: flex;
416
+ justify-content: space-between;
417
+ align-items: center;
418
+ margin-bottom: 15px;
419
+ }
420
+
421
+ .tts-title {
422
+ font-weight: 600;
423
+ color: #f43f5e;
424
+ }
425
+
426
+ .tts-close-btn {
427
+ background: none;
428
+ border: none;
429
+ color: rgba(255, 255, 255, 0.5);
430
+ font-size: 20px;
431
+ cursor: pointer;
432
+ transition: all 0.2s ease;
433
+ }
434
+
435
+ .tts-close-btn:hover {
436
+ color: white;
437
+ }
438
+
439
+ .tts-content {
440
+ max-height: 300px;
441
+ overflow-y: auto;
442
+ margin-bottom: 15px;
443
+ }
444
+
445
+ .tts-status {
446
+ font-size: 14px;
447
+ color: rgba(255, 255, 255, 0.7);
448
+ margin-bottom: 10px;
449
+ text-align: center;
450
+ }
451
+
452
+ .tts-transcript {
453
+ background: rgba(15, 23, 42, 0.7);
454
+ border-radius: 8px;
455
+ padding: 10px;
456
+ min-height: 60px;
457
+ margin-bottom: 15px;
458
+ }
459
+
460
+ .tts-controls {
461
+ display: flex;
462
+ justify-content: center;
463
+ gap: 10px;
464
+ }
465
+
466
+ .tts-controls button {
467
+ background: #f43f5e;
468
+ color: white;
469
+ border: none;
470
+ border-radius: 8px;
471
+ padding: 8px 15px;
472
+ cursor: pointer;
473
+ transition: all 0.2s ease;
474
+ display: flex;
475
+ align-items: center;
476
+ gap: 5px;
477
+ }
478
+
479
+ .tts-controls button:hover {
480
+ background: #e11d48;
481
+ }
482
+
483
+ .tts-controls button.secondary {
484
+ background: rgba(255, 255, 255, 0.1);
485
+ }
486
+
487
+ .tts-controls button.secondary:hover {
488
+ background: rgba(255, 255, 255, 0.2);
489
+ }
490
+
491
+ @keyframes pulse-red {
492
+ 0% {
493
+ box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7);
494
+ }
495
+ 70% {
496
+ box-shadow: 0 0 0 10px rgba(244, 63, 94, 0);
497
+ }
498
+ 100% {
499
+ box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
500
+ }
501
+ }
502
+
503
+ /* Scrollbar styling */
504
+ ::-webkit-scrollbar {
505
+ width: 6px;
506
+ }
507
+
508
+ ::-webkit-scrollbar-track {
509
+ background: rgba(255, 255, 255, 0.05);
510
+ border-radius: 3px;
511
+ }
512
+
513
+ ::-webkit-scrollbar-thumb {
514
+ background: rgba(255, 255, 255, 0.2);
515
+ border-radius: 3px;
516
+ }
517
+
518
+ ::-webkit-scrollbar-thumb:hover {
519
+ background: rgba(255, 255, 255, 0.3);
520
+ }
521
+ </style>
522
+ </head>
523
+ <body>
524
+ <!-- Video Avatar Container -->
525
+ <div class="video-container">
526
+ <div class="video-placeholder" id="video-placeholder">
527
+ <div class="avatar-placeholder-text">
528
+ <i class="fas fa-user-circle text-6xl mb-4"></i>
529
+ <p>Upload an image to create your AI video avatar</p>
530
+ </div>
531
+ </div>
532
+ <div class="video-overlay"></div>
533
+ </div>
534
+
535
+ <!-- Upload Button -->
536
+ <button class="upload-btn" onclick="document.getElementById('file-input').click()">
537
+ <i class="fas fa-upload upload-icon"></i>
538
+ Upload Avatar Image
539
+ </button>
540
+ <input type="file" id="file-input" accept="image/*">
541
+
542
+ <!-- Content Container -->
543
+ <div class="content-container">
544
+ <!-- Speech Bubble -->
545
+ <div class="speech-bubble p-6 mb-6 mx-4 relative">
546
+ <div id="avatar-message" class="text-lg">
547
+ Hello there! I'm your AI Avatar. Upload an image to create your personalized video avatar.
548
+ </div>
549
+ <div id="typing-indicator" class="typing-indicator hidden mt-2">
550
+ <span></span>
551
+ <span></span>
552
+ <span></span>
553
+ </div>
554
+ </div>
555
+
556
+ <!-- Social Media & Controls -->
557
+ <div class="flex justify-center gap-6 mt-8">
558
+ <button onclick="shareOnSocial('twitter')" class="social-icon text-blue-400 hover:text-blue-300 text-2xl">
559
+ <i class="fab fa-twitter"></i>
560
+ </button>
561
+ <button onclick="shareOnSocial('facebook')" class="social-icon text-blue-500 hover:text-blue-400 text-2xl">
562
+ <i class="fab fa-facebook"></i>
563
+ </button>
564
+ <button onclick="shareOnSocial('linkedin')" class="social-icon text-blue-600 hover:text-blue-500 text-2xl">
565
+ <i class="fab fa-linkedin"></i>
566
+ </button>
567
+ <button onclick="toggleFullscreen()" class="social-icon text-white hover:text-gray-300 text-2xl ml-4">
568
+ <i class="fas fa-expand"></i>
569
+ </button>
570
+ <button onclick="toggleMute()" class="social-icon text-white hover:text-gray-300 text-2xl">
571
+ <i id="mute-icon" class="fas fa-volume-up"></i>
572
+ </button>
573
+ </div>
574
+ </div>
575
+
576
+ <!-- TTS (Voice Input) Button -->
577
+ <div class="tts-container">
578
+ <div class="tts-panel" id="tts-panel">
579
+ <div class="tts-header">
580
+ <div class="tts-title">Voice Command</div>
581
+ <button class="tts-close-btn" onclick="toggleTtsPanel()">
582
+ <i class="fas fa-times"></i>
583
+ </button>
584
+ </div>
585
+
586
+ <div class="tts-content">
587
+ <div class="tts-status" id="tts-status">
588
+ Click the microphone to start speaking
589
+ </div>
590
+ <div class="tts-transcript" id="tts-transcript">
591
+ Your voice input will appear here...
592
+ </div>
593
+ </div>
594
+
595
+ <div class="tts-controls">
596
+ <button id="tts-start-btn" onclick="startVoiceRecognition()">
597
+ <i class="fas fa-microphone"></i> Start
598
+ </button>
599
+ <button class="secondary" onclick="clearTranscript()">
600
+ <i class="fas fa-trash"></i> Clear
601
+ </button>
602
+ <button class="secondary" onclick="submitVoiceCommand()">
603
+ <i class="fas fa-paper-plane"></i> Send
604
+ </button>
605
+ </div>
606
+ </div>
607
+
608
+ <button class="tts-button" id="tts-button" onclick="toggleTtsPanel()">
609
+ <img src="https://cdn-icons-png.flaticon.com/512/4712/4712139.png" width="30" height="30" alt="Voice Assistant">
610
+ </button>
611
+ </div>
612
+
613
+ <!-- Floating Action Button -->
614
+ <div class="fab-container">
615
+ <div class="fab-menu" id="fab-menu">
616
+ <div class="fab-menu-header">
617
+ <div class="fab-menu-title">AI Assistant</div>
618
+ <button class="fab-close-btn" onclick="toggleFabMenu()">
619
+ <i class="fas fa-times"></i>
620
+ </button>
621
+ </div>
622
+
623
+ <div class="fab-menu-tabs">
624
+ <div class="fab-tab active" onclick="switchTab('topics')">Topics</div>
625
+ <div class="fab-tab" onclick="switchTab('chat')">Chat</div>
626
+ </div>
627
+
628
+ <div class="fab-menu-content">
629
+ <div class="fab-tab-content active" id="topics-tab">
630
+ <div class="grid grid-cols-1 gap-3">
631
+ <div class="news-card p-4 rounded-xl cursor-pointer" onclick="selectTopic('technology')">
632
+ <h3 class="font-bold text-blue-300">Tech Updates</h3>
633
+ <p class="text-sm">Latest in AI and gadgets</p>
634
+ </div>
635
+ <div class="news-card p-4 rounded-xl cursor-pointer" onclick="selectTopic('entertainment')">
636
+ <h3 class="font-bold text-pink-300">Entertainment</h3>
637
+ <p class="text-sm">Movies, music and celebrity news</p>
638
+ </div>
639
+ </div>
640
+ </div>
641
+
642
+ <div class="fab-tab-content" id="chat-tab">
643
+ <div class="text-center text-gray-400 py-4">
644
+ Ask me anything about technology, entertainment, or current events
645
+ </div>
646
+ <div class="fab-chat-input">
647
+ <input type="text" id="fab-user-input" placeholder="Type your message...">
648
+ <button onclick="sendMessageFromFab()">
649
+ <i class="fas fa-paper-plane"></i>
650
+ </button>
651
+ </div>
652
+ </div>
653
+ </div>
654
+ </div>
655
+
656
+ <div class="fab-main" onclick="toggleFabMenu()">
657
+ <i class="fas fa-comment-dots"></i>
658
+ </div>
659
+ </div>
660
+
661
+ <script>
662
+ // Speech Synthesis
663
+ const synth = window.speechSynthesis;
664
+ let isSpeaking = false;
665
+ let isMuted = false;
666
+
667
+ // Voice recognition
668
+ let recognition;
669
+ let isListening = false;
670
+ let finalTranscript = '';
671
+
672
+ // Sample knowledge base
673
+ const knowledgeBase = {
674
+ technology: [
675
+ "The latest AI models can now generate realistic video from text prompts. This could revolutionize content creation.",
676
+ "Quantum computing is making progress with several companies announcing breakthroughs in qubit stability.",
677
+ "The metaverse continues to evolve with new VR headsets offering higher resolution and better motion tracking."
678
+ ],
679
+ entertainment: [
680
+ "The summer blockbuster season is heating up with several highly anticipated movies releasing this month.",
681
+ "Streaming platforms are investing heavily in original content, with over 500 new shows announced this year.",
682
+ "Music festivals are returning in full force after the pandemic, with record ticket sales reported."
683
+ ],
684
+ default: [
685
+ "I'm here to help you stay informed about the latest trends and news.",
686
+ "Did you know I can summarize complex topics into easy-to-understand explanations?",
687
+ "Feel free to ask me about technology, entertainment, or current events."
688
+ ]
689
+ };
690
+
691
+ // Initialize
692
+ document.addEventListener('DOMContentLoaded', () => {
693
+ // Start with a greeting
694
+ setTimeout(() => {
695
+ speak("Hello there! I'm your AI guide. Upload an image to create your personalized video avatar.");
696
+ }, 1000);
697
+
698
+ // Set up image upload
699
+ document.getElementById('file-input').addEventListener('change', handleImageUpload);
700
+
701
+ // Set up keyboard events for fab input
702
+ document.getElementById('fab-user-input').addEventListener('keypress', (e) => {
703
+ if (e.key === 'Enter') {
704
+ sendMessageFromFab();
705
+ }
706
+ });
707
+
708
+ // Initialize voice recognition
709
+ initVoiceRecognition();
710
+ });
711
+
712
+ // Handle image upload
713
+ function handleImageUpload(event) {
714
+ const file = event.target.files[0];
715
+ if (!file) return;
716
+
717
+ const reader = new FileReader();
718
+ reader.onload = function(e) {
719
+ const placeholder = document.getElementById('video-placeholder');
720
+ placeholder.innerHTML = '';
721
+
722
+ const img = document.createElement('img');
723
+ img.src = e.target.result;
724
+ img.alt = 'AI Avatar';
725
+ placeholder.appendChild(img);
726
+
727
+ // Simulate video processing
728
+ setTimeout(() => {
729
+ speak("Thank you! Your AI video avatar is being processed. In a real implementation, this would generate a lifelike talking avatar from your image.");
730
+ }, 1000);
731
+ };
732
+ reader.readAsDataURL(file);
733
+ }
734
+
735
+ // Speech function
736
+ function speak(text) {
737
+ if (isMuted) return;
738
+
739
+ const utterance = new SpeechSynthesisUtterance(text);
740
+ utterance.voice = synth.getVoices().find(voice => voice.name.includes('English'));
741
+ utterance.pitch = 1;
742
+ utterance.rate = 1;
743
+ utterance.volume = 1;
744
+
745
+ isSpeaking = true;
746
+ synth.speak(utterance);
747
+
748
+ utterance.onend = () => {
749
+ isSpeaking = false;
750
+ };
751
+
752
+ // Display message
753
+ document.getElementById('avatar-message').textContent = text;
754
+ }
755
+
756
+ // Process user input
757
+ function sendMessage() {
758
+ const input = document.getElementById('user-input');
759
+ const message = input.value.trim();
760
+
761
+ if (message) {
762
+ // Show user message temporarily
763
+ document.getElementById('avatar-message').textContent = `You: ${message}`;
764
+ input.value = '';
765
+
766
+ // Show typing indicator
767
+ document.getElementById('typing-indicator').classList.remove('hidden');
768
+
769
+ // Process after delay
770
+ setTimeout(() => {
771
+ document.getElementById('typing-indicator').classList.add('hidden');
772
+ respondToMessage(message);
773
+ }, 1500);
774
+ }
775
+ }
776
+
777
+ // Process user input from FAB
778
+ function sendMessageFromFab() {
779
+ const input = document.getElementById('fab-user-input');
780
+ const message = input.value.trim();
781
+
782
+ if (message) {
783
+ // Show user message temporarily
784
+ document.getElementById('avatar-message').textContent = `You: ${message}`;
785
+ input.value = '';
786
+
787
+ // Show typing indicator
788
+ document.getElementById('typing-indicator').classList.remove('hidden');
789
+
790
+ // Process after delay
791
+ setTimeout(() => {
792
+ document.getElementById('typing-indicator').classList.add('hidden');
793
+ respondToMessage(message);
794
+ }, 1500);
795
+ }
796
+ }
797
+
798
+ // AI response logic
799
+ function respondToMessage(message) {
800
+ let response = "";
801
+ const lowerMsg = message.toLowerCase();
802
+
803
+ if (lowerMsg.includes('tech') || lowerMsg.includes('technology')) {
804
+ const techResponses = knowledgeBase.technology;
805
+ response = techResponses[Math.floor(Math.random() * techResponses.length)];
806
+ }
807
+ else if (lowerMsg.includes('movie') || lowerMsg.includes('music') || lowerMsg.includes('entertainment')) {
808
+ const entResponses = knowledgeBase.entertainment;
809
+ response = entResponses[Math.floor(Math.random() * entResponses.length)];
810
+ }
811
+ else if (lowerMsg.includes('hello') || lowerMsg.includes('hi')) {
812
+ response = "Hello! It's great to connect with you. How can I assist you today?";
813
+ }
814
+ else if (lowerMsg.includes('how are you')) {
815
+ response = "I'm an AI, so I don't have feelings, but I'm functioning optimally and ready to help you!";
816
+ }
817
+ else {
818
+ const defaultResponses = knowledgeBase.default;
819
+ response = defaultResponses[Math.floor(Math.random() * defaultResponses.length)];
820
+ }
821
+
822
+ speak(response);
823
+ }
824
+
825
+ // Topic selection
826
+ function selectTopic(topic) {
827
+ const message = `Tell me about ${topic}`;
828
+ document.getElementById('avatar-message').textContent = `You: ${message}`;
829
+
830
+ // Show typing indicator
831
+ document.getElementById('typing-indicator').classList.remove('hidden');
832
+
833
+ // Process after delay
834
+ setTimeout(() => {
835
+ document.getElementById('typing-indicator').classList.add('hidden');
836
+ respondToMessage(message);
837
+ }, 1500);
838
+
839
+ // Close the menu
840
+ toggleFabMenu();
841
+ }
842
+
843
+ // Social sharing
844
+ function shareOnSocial(platform) {
845
+ const text = encodeURIComponent("Check out this amazing AI video avatar I'm interacting with!");
846
+ const url = encodeURIComponent(window.location.href);
847
+
848
+ let shareUrl = "";
849
+ switch(platform) {
850
+ case 'twitter':
851
+ shareUrl = `https://twitter.com/intent/tweet?text=${text}&url=${url}`;
852
+ break;
853
+ case 'facebook':
854
+ shareUrl = `https://www.facebook.com/sharer/sharer.php?u=${url}`;
855
+ break;
856
+ case 'linkedin':
857
+ shareUrl = `https://www.linkedin.com/shareArticle?mini=true&url=${url}&title=${text}`;
858
+ break;
859
+ }
860
+
861
+ window.open(shareUrl, '_blank', 'width=600,height=400');
862
+ }
863
+
864
+ // Fullscreen toggle
865
+ function toggleFullscreen() {
866
+ if (!document.fullscreenElement) {
867
+ document.documentElement.requestFullscreen();
868
+ } else {
869
+ if (document.exitFullscreen) {
870
+ document.exitFullscreen();
871
+ }
872
+ }
873
+ }
874
+
875
+ // Mute toggle
876
+ function toggleMute() {
877
+ isMuted = !isMuted;
878
+ const icon = document.getElementById('mute-icon');
879
+
880
+ if (isMuted) {
881
+ icon.classList.remove('fa-volume-up');
882
+ icon.classList.add('fa-volume-mute');
883
+ synth.cancel();
884
+ } else {
885
+ icon.classList.remove('fa-volume-mute');
886
+ icon.classList.add('fa-volume-up');
887
+ }
888
+ }
889
+
890
+ // Toggle FAB menu
891
+ function toggleFabMenu() {
892
+ const menu = document.getElementById('fab-menu');
893
+ menu.classList.toggle('active');
894
+ }
895
+
896
+ // Switch between tabs in FAB menu
897
+ function switchTab(tabName) {
898
+ // Update active tab
899
+ document.querySelectorAll('.fab-tab').forEach(tab => {
900
+ tab.classList.remove('active');
901
+ });
902
+ event.target.classList.add('active');
903
+
904
+ // Update active content
905
+ document.querySelectorAll('.fab-tab-content').forEach(content => {
906
+ content.classList.remove('active');
907
+ });
908
+ document.getElementById(`${tabName}-tab`).classList.add('active');
909
+ }
910
+
911
+ // Toggle TTS panel
912
+ function toggleTtsPanel() {
913
+ const panel = document.getElementById('tts-panel');
914
+ panel.classList.toggle('active');
915
+
916
+ // Close FAB menu if open
917
+ document.getElementById('fab-menu').classList.remove('active');
918
+ }
919
+
920
+ // Initialize voice recognition
921
+ function initVoiceRecognition() {
922
+ try {
923
+ const SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
924
+ recognition = new SpeechRecognition();
925
+ recognition.continuous = false;
926
+ recognition.interimResults = true;
927
+
928
+ recognition.onstart = function() {
929
+ isListening = true;
930
+ document.getElementById('tts-button').classList.add('listening');
931
+ document.getElementById('tts-status').textContent = 'Listening... Speak now';
932
+ };
933
+
934
+ recognition.onerror = function(event) {
935
+ console.error('Speech recognition error', event.error);
936
+ stopVoiceRecognition();
937
+ document.getElementById('tts-status').textContent = 'Error: ' + event.error;
938
+ };
939
+
940
+ recognition.onend = function() {
941
+ stopVoiceRecognition();
942
+ if (finalTranscript.trim()) {
943
+ document.getElementById('tts-status').textContent = 'Click send or speak again';
944
+ } else {
945
+ document.getElementById('tts-status').textContent = 'Click the microphone to start speaking';
946
+ }
947
+ };
948
+
949
+ recognition.onresult = function(event) {
950
+ let interimTranscript = '';
951
+
952
+ for (let i = event.resultIndex; i < event.results.length; i++) {
953
+ const transcript = event.results[i][0].transcript;
954
+ if (event.results[i].isFinal) {
955
+ finalTranscript += transcript;
956
+ } else {
957
+ interimTranscript += transcript;
958
+ }
959
+ }
960
+
961
+ document.getElementById('tts-transcript').innerHTML =
962
+ `<span class="text-white">${finalTranscript}</span>` +
963
+ `<span class="text-gray-400">${interimTranscript}</span>`;
964
+ };
965
+ } catch (e) {
966
+ console.error('Speech recognition not supported', e);
967
+ document.getElementById('tts-status').textContent = 'Voice recognition not supported in this browser';
968
+ document.getElementById('tts-start-btn').disabled = true;
969
+ }
970
+ }
971
+
972
+ // Start voice recognition
973
+ function startVoiceRecognition() {
974
+ if (!recognition) return;
975
+
976
+ finalTranscript = '';
977
+ document.getElementById('tts-transcript').textContent = 'Your voice input will appear here...';
978
+
979
+ try {
980
+ recognition.start();
981
+ } catch (e) {
982
+ console.error('Error starting recognition:', e);
983
+ document.getElementById('tts-status').textContent = 'Error starting voice recognition';
984
+ }
985
+ }
986
+
987
+ // Stop voice recognition
988
+ function stopVoiceRecognition() {
989
+ isListening = false;
990
+ document.getElementById('tts-button').classList.remove('listening');
991
+
992
+ if (recognition) {
993
+ recognition.stop();
994
+ }
995
+ }
996
+
997
+ // Clear transcript
998
+ function clearTranscript() {
999
+ finalTranscript = '';
1000
+ document.getElementById('tts-transcript').textContent = 'Your voice input will appear here...';
1001
+ document.getElementById('tts-status').textContent = 'Click the microphone to start speaking';
1002
+ }
1003
+
1004
+ // Submit voice command
1005
+ function submitVoiceCommand() {
1006
+ if (finalTranscript.trim()) {
1007
+ // Close TTS panel
1008
+ toggleTtsPanel();
1009
+
1010
+ // Show user message
1011
+ document.getElementById('avatar-message').textContent = `You: ${finalTranscript}`;
1012
+
1013
+ // Show typing indicator
1014
+ document.getElementById('typing-indicator').classList.remove('hidden');
1015
+
1016
+ // Process after delay
1017
+ setTimeout(() => {
1018
+ document.getElementById('typing-indicator').classList.add('hidden');
1019
+ respondToMessage(finalTranscript);
1020
+ }, 1500);
1021
+
1022
+ // Clear transcript
1023
+ clearTranscript();
1024
+ }
1025
+ }
1026
+
1027
+ // Keyboard support
1028
+ document.getElementById('user-input').addEventListener('keypress', (e) => {
1029
+ if (e.key === 'Enter') {
1030
+ sendMessage();
1031
+ }
1032
+ });
1033
+ </script>
1034
+ <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=privateuserh/ai-avatar-v1-02" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1035
+ </html>