jerrychen428 commited on
Commit
a193917
·
verified ·
1 Parent(s): ff6b45c

Upload logic_v1_demo.html

Browse files
Files changed (1) hide show
  1. logic_v1_demo.html +437 -0
logic_v1_demo.html ADDED
@@ -0,0 +1,437 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-TW">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Hugging Face Space Demo</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
16
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
17
+ min-height: 100vh;
18
+ display: flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ }
22
+
23
+ /* 登入頁面樣式 */
24
+ .login-container {
25
+ background: white;
26
+ padding: 40px;
27
+ border-radius: 15px;
28
+ box-shadow: 0 20px 40px rgba(0,0,0,0.1);
29
+ width: 100%;
30
+ max-width: 400px;
31
+ text-align: center;
32
+ }
33
+
34
+ .login-title {
35
+ color: #333;
36
+ margin-bottom: 10px;
37
+ font-size: 28px;
38
+ font-weight: 600;
39
+ }
40
+
41
+ .login-subtitle {
42
+ color: #666;
43
+ margin-bottom: 30px;
44
+ font-size: 14px;
45
+ }
46
+
47
+ .form-group {
48
+ margin-bottom: 20px;
49
+ text-align: left;
50
+ }
51
+
52
+ .form-group label {
53
+ display: block;
54
+ margin-bottom: 5px;
55
+ color: #333;
56
+ font-weight: 500;
57
+ }
58
+
59
+ .form-group input {
60
+ width: 100%;
61
+ padding: 12px;
62
+ border: 2px solid #e1e5e9;
63
+ border-radius: 8px;
64
+ font-size: 16px;
65
+ transition: border-color 0.3s;
66
+ }
67
+
68
+ .form-group input:focus {
69
+ outline: none;
70
+ border-color: #667eea;
71
+ }
72
+
73
+ .captcha-container {
74
+ display: flex;
75
+ align-items: center;
76
+ gap: 10px;
77
+ margin-bottom: 20px;
78
+ }
79
+
80
+ .captcha-code {
81
+ background: #f8f9fa;
82
+ border: 2px solid #e1e5e9;
83
+ border-radius: 8px;
84
+ padding: 12px;
85
+ font-size: 18px;
86
+ font-weight: bold;
87
+ color: #333;
88
+ letter-spacing: 2px;
89
+ min-width: 100px;
90
+ text-align: center;
91
+ cursor: pointer;
92
+ user-select: none;
93
+ }
94
+
95
+ .captcha-input {
96
+ flex: 1;
97
+ padding: 12px;
98
+ border: 2px solid #e1e5e9;
99
+ border-radius: 8px;
100
+ font-size: 16px;
101
+ }
102
+
103
+ .captcha-refresh {
104
+ background: #667eea;
105
+ color: white;
106
+ border: none;
107
+ border-radius: 8px;
108
+ padding: 12px;
109
+ cursor: pointer;
110
+ font-size: 14px;
111
+ transition: background-color 0.3s;
112
+ }
113
+
114
+ .captcha-refresh:hover {
115
+ background: #5a6fd8;
116
+ }
117
+
118
+ .login-btn {
119
+ width: 100%;
120
+ padding: 12px;
121
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
122
+ color: white;
123
+ border: none;
124
+ border-radius: 8px;
125
+ font-size: 16px;
126
+ font-weight: 600;
127
+ cursor: pointer;
128
+ transition: transform 0.2s, box-shadow 0.2s;
129
+ }
130
+
131
+ .login-btn:hover {
132
+ transform: translateY(-2px);
133
+ box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
134
+ }
135
+
136
+ .error-message {
137
+ color: #e74c3c;
138
+ margin-top: 10px;
139
+ font-size: 14px;
140
+ }
141
+
142
+ /* 主應用程式樣式 */
143
+ .app-container {
144
+ display: none;
145
+ width: 100vw;
146
+ height: 100vh;
147
+ background: #f5f7fa;
148
+ }
149
+
150
+ .app-header {
151
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
152
+ color: white;
153
+ padding: 20px;
154
+ text-align: center;
155
+ position: relative;
156
+ }
157
+
158
+ .app-title {
159
+ font-size: 32px;
160
+ font-weight: 700;
161
+ margin-bottom: 5px;
162
+ }
163
+
164
+ .app-subtitle {
165
+ font-size: 14px;
166
+ opacity: 0.9;
167
+ }
168
+
169
+ .logout-btn {
170
+ position: absolute;
171
+ top: 20px;
172
+ right: 20px;
173
+ background: rgba(255,255,255,0.2);
174
+ color: white;
175
+ border: 2px solid rgba(255,255,255,0.3);
176
+ padding: 8px 16px;
177
+ border-radius: 20px;
178
+ cursor: pointer;
179
+ font-size: 14px;
180
+ transition: all 0.3s;
181
+ }
182
+
183
+ .logout-btn:hover {
184
+ background: rgba(255,255,255,0.3);
185
+ border-color: rgba(255,255,255,0.5);
186
+ }
187
+
188
+ .main-content {
189
+ display: flex;
190
+ height: calc(100vh - 120px);
191
+ }
192
+
193
+ .sidebar {
194
+ width: 250px;
195
+ background: white;
196
+ box-shadow: 2px 0 10px rgba(0,0,0,0.1);
197
+ padding: 20px 0;
198
+ }
199
+
200
+ .tab {
201
+ display: block;
202
+ width: 100%;
203
+ padding: 15px 25px;
204
+ background: none;
205
+ border: none;
206
+ text-align: left;
207
+ cursor: pointer;
208
+ font-size: 16px;
209
+ color: #333;
210
+ border-left: 4px solid transparent;
211
+ transition: all 0.3s;
212
+ }
213
+
214
+ .tab:hover {
215
+ background: #f8f9fa;
216
+ color: #667eea;
217
+ }
218
+
219
+ .tab.active {
220
+ background: #f0f3ff;
221
+ color: #667eea;
222
+ border-left-color: #667eea;
223
+ font-weight: 600;
224
+ }
225
+
226
+ .content-area {
227
+ flex: 1;
228
+ padding: 20px;
229
+ }
230
+
231
+ .iframe-container {
232
+ display: none;
233
+ width: 100%;
234
+ height: 100%;
235
+ border-radius: 10px;
236
+ overflow: hidden;
237
+ box-shadow: 0 5px 15px rgba(0,0,0,0.1);
238
+ }
239
+
240
+ .iframe-container.active {
241
+ display: block;
242
+ }
243
+
244
+ .iframe-container iframe {
245
+ width: 100%;
246
+ height: 100%;
247
+ border: none;
248
+ }
249
+
250
+ .welcome-content {
251
+ display: flex;
252
+ align-items: center;
253
+ justify-content: center;
254
+ height: 100%;
255
+ flex-direction: column;
256
+ color: #666;
257
+ }
258
+
259
+ .welcome-content h2 {
260
+ font-size: 24px;
261
+ margin-bottom: 10px;
262
+ color: #333;
263
+ }
264
+
265
+ .welcome-content p {
266
+ font-size: 16px;
267
+ line-height: 1.6;
268
+ }
269
+ </style>
270
+ </head>
271
+ <body>
272
+ <!-- 登入頁面 -->
273
+ <div id="loginPage" class="login-container">
274
+ <h1 class="login-title">Hugging Face Space Demo</h1>
275
+ <p class="login-subtitle">cjhuang@2025copyright</p>
276
+
277
+ <form id="loginForm">
278
+ <div class="form-group">
279
+ <label for="username">帳號</label>
280
+ <input type="text" id="username" name="username" required>
281
+ </div>
282
+
283
+ <div class="form-group">
284
+ <label for="password">密碼</label>
285
+ <input type="password" id="password" name="password" required>
286
+ </div>
287
+
288
+ <div class="form-group">
289
+ <label for="captcha">驗證碼</label>
290
+ <div class="captcha-container">
291
+ <div class="captcha-code" id="captchaCode" onclick="generateCaptcha()"></div>
292
+ <input type="text" id="captchaInput" class="captcha-input" placeholder="請輸入驗證碼" required>
293
+ <button type="button" class="captcha-refresh" onclick="generateCaptcha()">刷新</button>
294
+ </div>
295
+ </div>
296
+
297
+ <button type="submit" class="login-btn">登入</button>
298
+ <div id="errorMessage" class="error-message"></div>
299
+ </form>
300
+ </div>
301
+
302
+ <!-- 主應用程式 -->
303
+ <div id="appContainer" class="app-container">
304
+ <header class="app-header">
305
+ <h1 class="app-title">Hugging Face Space Demo</h1>
306
+ <p class="app-subtitle">cjhuang@2025copyright</p>
307
+ <button class="logout-btn" onclick="logout()">登出</button>
308
+ </header>
309
+
310
+ <div class="main-content">
311
+ <nav class="sidebar">
312
+ <button class="tab active" onclick="showTab('welcome')">歡迎頁面</button>
313
+ <button class="tab" onclick="showTab('multimodal')">多模態API</button>
314
+ <button class="tab" onclick="showTab('webcam')">WEBCAM_LineBot</button>
315
+ </nav>
316
+
317
+ <main class="content-area">
318
+ <div id="welcomeContent" class="iframe-container active">
319
+ <div class="welcome-content">
320
+ <h2>歡迎使用 Hugging Face Space Demo</h2>
321
+ <p>請選擇左側選單來瀏覽不同的應用程式。</p>
322
+ </div>
323
+ </div>
324
+
325
+ <div id="multimodalContent" class="iframe-container">
326
+ <iframe src="https://cjian2025-groq-api-gradio.hf.space" title="多模態API"></iframe>
327
+ </div>
328
+
329
+ <div id="webcamContent" class="iframe-container">
330
+ <iframe src="https://cjian2025-webcam-groq-linebot-application.hf.space" title="WEBCAM_LineBot"></iframe>
331
+ </div>
332
+ </main>
333
+ </div>
334
+ </div>
335
+
336
+ <script>
337
+ let currentCaptcha = '';
338
+
339
+ // 生成驗證碼
340
+ function generateCaptcha() {
341
+ const chars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789';
342
+ let captcha = '';
343
+ for (let i = 0; i < 5; i++) {
344
+ captcha += chars.charAt(Math.floor(Math.random() * chars.length));
345
+ }
346
+ currentCaptcha = captcha;
347
+ document.getElementById('captchaCode').textContent = captcha;
348
+ }
349
+
350
+ // 初始化驗證碼
351
+ generateCaptcha();
352
+
353
+ // 登入表單處理
354
+ document.getElementById('loginForm').addEventListener('submit', function(e) {
355
+ e.preventDefault();
356
+
357
+ const username = document.getElementById('username').value;
358
+ const password = document.getElementById('password').value;
359
+ const captchaInput = document.getElementById('captchaInput').value;
360
+ const errorDiv = document.getElementById('errorMessage');
361
+
362
+ // 清除之前的錯誤訊息
363
+ errorDiv.textContent = '';
364
+
365
+ // 驗證帳號密碼
366
+ if (username !== 'ROOT2025') {
367
+ errorDiv.textContent = '帳號錯誤!';
368
+ return;
369
+ }
370
+
371
+ if (password !== '123456') {
372
+ errorDiv.textContent = '密碼錯誤!';
373
+ return;
374
+ }
375
+
376
+ // 驗證驗證碼(不區分大小寫)
377
+ if (captchaInput.toLowerCase() !== currentCaptcha.toLowerCase()) {
378
+ errorDiv.textContent = '驗證碼錯誤!';
379
+ generateCaptcha(); // 重新生成驗證碼
380
+ document.getElementById('captchaInput').value = '';
381
+ return;
382
+ }
383
+
384
+ // 登入成功
385
+ document.getElementById('loginPage').style.display = 'none';
386
+ document.getElementById('appContainer').style.display = 'block';
387
+ });
388
+
389
+ // 頁籤切換功能
390
+ function showTab(tabName) {
391
+ // 隱藏所有內容
392
+ const contents = document.querySelectorAll('.iframe-container');
393
+ contents.forEach(content => {
394
+ content.classList.remove('active');
395
+ });
396
+
397
+ // 移除所有頁籤的active狀態
398
+ const tabs = document.querySelectorAll('.tab');
399
+ tabs.forEach(tab => {
400
+ tab.classList.remove('active');
401
+ });
402
+
403
+ // 顯示選中的內容
404
+ if (tabName === 'welcome') {
405
+ document.getElementById('welcomeContent').classList.add('active');
406
+ tabs[0].classList.add('active');
407
+ } else if (tabName === 'multimodal') {
408
+ document.getElementById('multimodalContent').classList.add('active');
409
+ tabs[1].classList.add('active');
410
+ } else if (tabName === 'webcam') {
411
+ document.getElementById('webcamContent').classList.add('active');
412
+ tabs[2].classList.add('active');
413
+ }
414
+ }
415
+
416
+ // 登出功能
417
+ function logout() {
418
+ // 重置表單
419
+ document.getElementById('loginForm').reset();
420
+ document.getElementById('errorMessage').textContent = '';
421
+ generateCaptcha();
422
+
423
+ // 切換回登入頁面
424
+ document.getElementById('appContainer').style.display = 'none';
425
+ document.getElementById('loginPage').style.display = 'block';
426
+
427
+ // 重置到歡迎頁面
428
+ showTab('welcome');
429
+ }
430
+
431
+ // 頁面載入時生成驗證碼
432
+ window.addEventListener('load', function() {
433
+ generateCaptcha();
434
+ });
435
+ </script>
436
+ </body>
437
+ </html>