akhaliq HF Staff commited on
Commit
4f69fb4
·
verified ·
1 Parent(s): 3ac7aa6

Upload style.css with huggingface_hub

Browse files
Files changed (1) hide show
  1. style.css +513 -44
style.css CHANGED
@@ -1,76 +1,545 @@
 
1
  * {
2
- box-sizing: border-box;
3
- padding: 0;
4
  margin: 0;
5
- font-family: sans-serif;
 
6
  }
7
 
8
- html,
9
- body {
10
- height: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  }
12
 
13
  body {
14
- padding: 32px;
 
 
 
 
15
  }
16
 
17
- body,
18
- #container {
19
  display: flex;
20
  flex-direction: column;
21
- justify-content: center;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  align-items: center;
 
 
23
  }
24
 
25
- #container {
26
- position: relative;
27
- gap: 0.4rem;
 
 
28
 
29
- width: 640px;
30
- height: 640px;
31
- max-width: 100%;
32
- max-height: 100%;
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
- border: 2px dashed #D1D5DB;
35
- border-radius: 0.75rem;
36
- overflow: hidden;
 
 
 
 
 
 
 
 
 
 
 
37
  cursor: pointer;
38
- margin: 1rem;
 
 
 
39
 
40
- background-size: 100% 100%;
41
- background-position: center;
42
- background-repeat: no-repeat;
43
- font-size: 18px;
44
  }
45
 
46
- #upload {
47
- display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
- svg {
51
- pointer-events: none;
52
  }
53
 
54
- #example {
55
- font-size: 14px;
56
- text-decoration: underline;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  cursor: pointer;
 
 
 
 
 
58
  }
59
 
60
- #example:hover {
61
- color: #2563EB;
 
62
  }
63
 
64
- .bounding-box {
65
- position: absolute;
66
- box-sizing: border-box;
67
- border: solid 2px;
 
 
 
 
 
68
  }
69
 
70
- .bounding-box-label {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  color: white;
72
- position: absolute;
73
- font-size: 12px;
74
- margin: -16px 0 0 -2px;
75
- padding: 1px;
76
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Reset and Base Styles */
2
  * {
 
 
3
  margin: 0;
4
+ padding: 0;
5
+ box-sizing: border-box;
6
  }
7
 
8
+ :root {
9
+ --primary-color: #2563eb;
10
+ --primary-hover: #1d4ed8;
11
+ --secondary-color: #f1f5f9;
12
+ --accent-color: #3b82f6;
13
+ --text-primary: #1e293b;
14
+ --text-secondary: #64748b;
15
+ --background: #ffffff;
16
+ --background-secondary: #f8fafc;
17
+ --border-color: #e2e8f0;
18
+ --success-color: #10b981;
19
+ --error-color: #ef4444;
20
+ --warning-color: #f59e0b;
21
+ --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
22
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
23
+ --border-radius: 8px;
24
+ --transition: all 0.2s ease-in-out;
25
  }
26
 
27
  body {
28
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
29
+ line-height: 1.6;
30
+ color: var(--text-primary);
31
+ background-color: var(--background-secondary);
32
+ min-height: 100vh;
33
  }
34
 
35
+ /* App Container */
36
+ .app-container {
37
  display: flex;
38
  flex-direction: column;
39
+ min-height: 100vh;
40
+ max-width: 1200px;
41
+ margin: 0 auto;
42
+ background-color: var(--background);
43
+ box-shadow: var(--shadow-lg);
44
+ }
45
+
46
+ /* Header */
47
+ .header {
48
+ background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
49
+ color: white;
50
+ padding: 2rem 1.5rem;
51
+ text-align: center;
52
+ }
53
+
54
+ .header-content {
55
+ max-width: 800px;
56
+ margin: 0 auto;
57
+ }
58
+
59
+ .title {
60
+ font-size: 2.5rem;
61
+ font-weight: 700;
62
+ margin-bottom: 0.5rem;
63
+ text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
64
+ }
65
+
66
+ .subtitle {
67
+ font-size: 1.1rem;
68
+ opacity: 0.9;
69
+ margin-bottom: 1rem;
70
+ }
71
+
72
+ .anycoder-link {
73
+ color: rgba(255, 255, 255, 0.9);
74
+ text-decoration: none;
75
+ font-size: 0.9rem;
76
+ padding: 0.5rem 1rem;
77
+ border: 1px solid rgba(255, 255, 255, 0.3);
78
+ border-radius: var(--border-radius);
79
+ transition: var(--transition);
80
+ display: inline-block;
81
+ }
82
+
83
+ .anycoder-link:hover {
84
+ background-color: rgba(255, 255, 255, 0.1);
85
+ border-color: rgba(255, 255, 255, 0.5);
86
+ }
87
+
88
+ /* Settings Panel */
89
+ .settings-panel {
90
+ background-color: var(--background);
91
+ border-bottom: 1px solid var(--border-color);
92
+ padding: 1.5rem;
93
+ }
94
+
95
+ .settings-content {
96
+ display: grid;
97
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
98
+ gap: 1rem;
99
  align-items: center;
100
+ max-width: 800px;
101
+ margin: 0 auto;
102
  }
103
 
104
+ .setting-group {
105
+ display: flex;
106
+ flex-direction: column;
107
+ gap: 0.5rem;
108
+ }
109
 
110
+ .setting-group label {
111
+ font-weight: 500;
112
+ font-size: 0.9rem;
113
+ color: var(--text-primary);
114
+ }
115
+
116
+ .device-select,
117
+ .model-select {
118
+ padding: 0.75rem;
119
+ border: 1px solid var(--border-color);
120
+ border-radius: var(--border-radius);
121
+ font-size: 0.9rem;
122
+ background-color: var(--background);
123
+ color: var(--text-primary);
124
+ transition: var(--transition);
125
+ }
126
 
127
+ .device-select:focus,
128
+ .model-select:focus {
129
+ outline: none;
130
+ border-color: var(--primary-color);
131
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
132
+ }
133
+
134
+ .initialize-btn {
135
+ background-color: var(--primary-color);
136
+ color: white;
137
+ border: none;
138
+ padding: 0.75rem 1.5rem;
139
+ border-radius: var(--border-radius);
140
+ font-weight: 500;
141
  cursor: pointer;
142
+ transition: var(--transition);
143
+ height: fit-content;
144
+ align-self: end;
145
+ }
146
 
147
+ .initialize-btn:hover:not(:disabled) {
148
+ background-color: var(--primary-hover);
149
+ transform: translateY(-1px);
 
150
  }
151
 
152
+ .initialize-btn:disabled {
153
+ opacity: 0.6;
154
+ cursor: not-allowed;
155
+ transform: none;
156
+ }
157
+
158
+ /* Chat Container */
159
+ .chat-container {
160
+ flex: 1;
161
+ display: flex;
162
+ flex-direction: column;
163
+ min-height: 0;
164
+ }
165
+
166
+ .chat-messages {
167
+ flex: 1;
168
+ padding: 1.5rem;
169
+ overflow-y: auto;
170
+ min-height: 400px;
171
+ max-height: 600px;
172
+ }
173
+
174
+ /* Message Styles */
175
+ .message {
176
+ display: flex;
177
+ gap: 1rem;
178
+ margin-bottom: 1.5rem;
179
+ animation: fadeInUp 0.3s ease-out;
180
+ }
181
+
182
+ @keyframes fadeInUp {
183
+ from {
184
+ opacity: 0;
185
+ transform: translateY(10px);
186
+ }
187
+ to {
188
+ opacity: 1;
189
+ transform: translateY(0);
190
+ }
191
+ }
192
+
193
+ .message-avatar {
194
+ width: 40px;
195
+ height: 40px;
196
+ border-radius: 50%;
197
+ display: flex;
198
+ align-items: center;
199
+ justify-content: center;
200
+ font-size: 1.2rem;
201
+ flex-shrink: 0;
202
  }
203
 
204
+ .user-message .message-avatar {
205
+ background-color: var(--secondary-color);
206
  }
207
 
208
+ .assistant-message .message-avatar,
209
+ .welcome-message .message-avatar {
210
+ background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
211
+ }
212
+
213
+ .message-content {
214
+ flex: 1;
215
+ max-width: 70%;
216
+ }
217
+
218
+ .user-message .message-content {
219
+ margin-left: auto;
220
+ text-align: right;
221
+ }
222
+
223
+ .user-message .user-message,
224
+ .assistant-message .assistant-message,
225
+ .welcome-message .assistant-message {
226
+ display: inline-block;
227
+ padding: 0.75rem 1rem;
228
+ border-radius: var(--border-radius);
229
+ font-size: 0.95rem;
230
+ line-height: 1.5;
231
+ word-wrap: break-word;
232
+ max-width: 100%;
233
+ }
234
+
235
+ .user-message .user-message {
236
+ background-color: var(--primary-color);
237
+ color: white;
238
+ border-bottom-right-radius: 4px;
239
+ }
240
+
241
+ .assistant-message .assistant-message,
242
+ .welcome-message .assistant-message {
243
+ background-color: var(--secondary-color);
244
+ color: var(--text-primary);
245
+ border-bottom-left-radius: 4px;
246
+ }
247
+
248
+ .welcome-message {
249
+ opacity: 0.8;
250
+ font-style: italic;
251
+ }
252
+
253
+ /* Input Area */
254
+ .input-area {
255
+ border-top: 1px solid var(--border-color);
256
+ padding: 1.5rem;
257
+ background-color: var(--background);
258
+ }
259
+
260
+ .input-container {
261
+ display: flex;
262
+ gap: 1rem;
263
+ max-width: 800px;
264
+ margin: 0 auto;
265
+ }
266
+
267
+ .message-input {
268
+ flex: 1;
269
+ padding: 1rem;
270
+ border: 1px solid var(--border-color);
271
+ border-radius: var(--border-radius);
272
+ font-size: 1rem;
273
+ resize: none;
274
+ font-family: inherit;
275
+ line-height: 1.5;
276
+ transition: var(--transition);
277
+ min-height: 50px;
278
+ max-height: 120px;
279
+ }
280
+
281
+ .message-input:focus {
282
+ outline: none;
283
+ border-color: var(--primary-color);
284
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
285
+ }
286
+
287
+ .message-input:disabled {
288
+ background-color: var(--background-secondary);
289
+ color: var(--text-secondary);
290
+ cursor: not-allowed;
291
+ }
292
+
293
+ .send-btn {
294
+ width: 50px;
295
+ height: 50px;
296
+ border: none;
297
+ border-radius: var(--border-radius);
298
+ background-color: var(--primary-color);
299
+ color: white;
300
  cursor: pointer;
301
+ display: flex;
302
+ align-items: center;
303
+ justify-content: center;
304
+ transition: var(--transition);
305
+ flex-shrink: 0;
306
  }
307
 
308
+ .send-btn:hover:not(:disabled) {
309
+ background-color: var(--primary-hover);
310
+ transform: scale(1.05);
311
  }
312
 
313
+ .send-btn:disabled {
314
+ opacity: 0.5;
315
+ cursor: not-allowed;
316
+ transform: none;
317
+ }
318
+
319
+ .send-icon {
320
+ font-size: 1.2rem;
321
+ transform: rotate(45deg);
322
  }
323
 
324
+ .input-status {
325
+ margin-top: 0.75rem;
326
+ text-align: center;
327
+ }
328
+
329
+ .status-text {
330
+ font-size: 0.85rem;
331
+ padding: 0.25rem 0.75rem;
332
+ border-radius: 12px;
333
+ display: inline-block;
334
+ transition: var(--transition);
335
+ }
336
+
337
+ .status-text.ready {
338
+ background-color: rgba(16, 185, 129, 0.1);
339
+ color: var(--success-color);
340
+ }
341
+
342
+ .status-text.loading,
343
+ .status-text.generating {
344
+ background-color: rgba(59, 130, 246, 0.1);
345
+ color: var(--accent-color);
346
+ }
347
+
348
+ .status-text.error {
349
+ background-color: rgba(239, 68, 68, 0.1);
350
+ color: var(--error-color);
351
+ }
352
+
353
+ /* Loading Overlay */
354
+ .loading-overlay {
355
+ position: fixed;
356
+ top: 0;
357
+ left: 0;
358
+ right: 0;
359
+ bottom: 0;
360
+ background-color: rgba(0, 0, 0, 0.7);
361
+ display: flex;
362
+ flex-direction: column;
363
+ align-items: center;
364
+ justify-content: center;
365
+ z-index: 1000;
366
+ backdrop-filter: blur(4px);
367
+ }
368
+
369
+ .loading-overlay.hidden {
370
+ display: none;
371
+ }
372
+
373
+ .loading-spinner {
374
+ width: 50px;
375
+ height: 50px;
376
+ border: 4px solid rgba(255, 255, 255, 0.3);
377
+ border-top: 4px solid white;
378
+ border-radius: 50%;
379
+ animation: spin 1s linear infinite;
380
+ margin-bottom: 1rem;
381
+ }
382
+
383
+ @keyframes spin {
384
+ 0% { transform: rotate(0deg); }
385
+ 100% { transform: rotate(360deg); }
386
+ }
387
+
388
+ .loading-text {
389
+ text-align: center;
390
  color: white;
391
+ }
392
+
393
+ .loading-text p {
394
+ margin-bottom: 0.5rem;
395
+ }
396
+
397
+ .loading-tips {
398
+ font-size: 0.9rem;
399
+ opacity: 0.8;
400
+ }
401
+
402
+ /* Responsive Design */
403
+ @media (max-width: 768px) {
404
+ .app-container {
405
+ margin: 0;
406
+ min-height: 100vh;
407
+ }
408
+
409
+ .header {
410
+ padding: 1.5rem 1rem;
411
+ }
412
+
413
+ .title {
414
+ font-size: 2rem;
415
+ }
416
+
417
+ .settings-panel {
418
+ padding: 1rem;
419
+ }
420
+
421
+ .settings-content {
422
+ grid-template-columns: 1fr;
423
+ gap: 1rem;
424
+ }
425
+
426
+ .chat-messages {
427
+ padding: 1rem;
428
+ min-height: 300px;
429
+ }
430
+
431
+ .message {
432
+ margin-bottom: 1rem;
433
+ }
434
+
435
+ .message-content {
436
+ max-width: 85%;
437
+ }
438
+
439
+ .input-area {
440
+ padding: 1rem;
441
+ }
442
+
443
+ .input-container {
444
+ flex-direction: column;
445
+ gap: 0.75rem;
446
+ }
447
+
448
+ .send-btn {
449
+ width: 100%;
450
+ height: 45px;
451
+ }
452
+ }
453
+
454
+ @media (max-width: 480px) {
455
+ .title {
456
+ font-size: 1.75rem;
457
+ }
458
+
459
+ .subtitle {
460
+ font-size: 1rem;
461
+ }
462
+
463
+ .message-avatar {
464
+ width: 35px;
465
+ height: 35px;
466
+ font-size: 1rem;
467
+ }
468
+
469
+ .message-content {
470
+ max-width: 90%;
471
+ }
472
+
473
+ .user-message .user-message,
474
+ .assistant-message .assistant-message {
475
+ padding: 0.6rem 0.8rem;
476
+ font-size: 0.9rem;
477
+ }
478
+ }
479
+
480
+ /* Scrollbar Styling */
481
+ .chat-messages::-webkit-scrollbar {
482
+ width: 6px;
483
+ }
484
+
485
+ .chat-messages::-webkit-scrollbar-track {
486
+ background: var(--background-secondary);
487
+ }
488
+
489
+ .chat-messages::-webkit-scrollbar-thumb {
490
+ background: var(--border-color);
491
+ border-radius: 3px;
492
+ }
493
+
494
+ .chat-messages::-webkit-scrollbar-thumb:hover {
495
+ background: var(--text-secondary);
496
+ }
497
+
498
+ /* Accessibility */
499
+ @media (prefers-reduced-motion: reduce) {
500
+ * {
501
+ animation-duration: 0.01ms !important;
502
+ animation-iteration-count: 1 !important;
503
+ transition-duration: 0.01ms !important;
504
+ }
505
+ }
506
+
507
+ /* Focus styles for keyboard navigation */
508
+ button:focus,
509
+ select:focus,
510
+ textarea:focus {
511
+ outline: 2px solid var(--primary-color);
512
+ outline-offset: 2px;
513
+ }
514
+
515
+ /* High contrast mode support */
516
+ @media (prefers-contrast: high) {
517
+ :root {
518
+ --border-color: #000000;
519
+ --text-secondary: #000000;
520
+ }
521
+ }
522
+
523
+ This chatbot application includes:
524
+
525
+ **Features:**
526
+ - Modern, responsive design that works on all devices
527
+ - Real-time streaming responses using TextStreamer
528
+ - Multiple model support (Gemma 3 270M, Gemma 2 2B, Llama 3.2 1B)
529
+ - CPU/GPU toggle with WebGPU support detection
530
+ - Professional UI with smooth animations
531
+ - Error handling and loading states
532
+ - Accessibility features (keyboard navigation, screen reader support)
533
+ - Chat history with system prompts
534
+ - Auto-resizing text input
535
+ - Mobile-optimized interface
536
+
537
+ **Key Technical Features:**
538
+ - Uses the exact transformers.js import and pipeline setup you specified
539
+ - Implements TextStreamer for real-time response streaming
540
+ - Handles multiple ONNX models for different performance needs
541
+ - Proper error handling and user feedback
542
+ - Responsive design that adapts to all screen sizes
543
+ - Professional styling with CSS custom properties
544
+
545
+ The application initializes models on-demand, streams responses in real-time, and provides a clean chat interface similar to modern AI chatbots.