File size: 14,321 Bytes
8f1463e
29f7355
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8f1463e
 
 
 
 
 
0244bd5
 
 
 
33d8106
0244bd5
 
 
8f1463e
 
524cef7
5216363
886a88a
5216363
 
 
 
f8a838e
637ba86
 
 
c0277c1
637ba86
c0277c1
ead90c9
 
0f09d43
 
 
 
 
 
 
 
 
 
 
637ba86
 
 
08ff3f4
f8a838e
524cef7
f8a838e
 
0f09d43
f8a838e
637ba86
5216363
ac1a23b
a683de4
 
ac1a23b
637ba86
6f6404b
8f1463e
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI Assistant Activated | Hourly 150MB</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        .animate-float {
            animation: float 6s ease-in-out infinite;
        }
        @keyframes float {
            0% { transform: translateY(0px) rotate(0deg); }
            50% { transform: translateY(-20px) rotate(3deg); }
            100% { transform: translateY(0px) rotate(0deg); }
        }
        .gradient-text {
            background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            background-size: 300% 300%;
            animation: gradient 8s ease infinite;
        }
        @keyframes gradient {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        .card-hover {
            transition: all 0.3s ease;
        }
        .card-hover:hover {
            transform: translateY(-5px) translateZ(0);
        }
        .pulse {
            animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
        }
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.7; }
        }
        .smooth-shadow {
            box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.15);
        }
        .input-shadow:focus {
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
        }
        .progress-bar {
            animation: progress 90s linear 1 forwards;
        }
        @keyframes progress {
            0% { width: 100%; }
            100% { width: 0%; }
        }
    </style>
</head>
<body class="font-['Inter'] bg-gradient-to-br from-gray-50 to-indigo-50 min-h-screen flex items-center justify-center p-4 sm:p-6">
    <div class="max-w-4xl w-full mx-auto">
        <!-- Notification Header -->
        <div class="bg-indigo-600/10 border border-indigo-600/20 text-indigo-800 px-4 py-3 rounded-lg mb-8 flex items-start">
            <div class="flex-shrink-0 pt-1 mr-3">
                <i class="fas fa-check-circle text-indigo-600"></i>
            </div>
            <div class="flex-1">
                <p class="font-medium">Hourly 150MB successfully activated!</p>
                <p class="text-sm text-indigo-700/90 mt-1">Your AI assistant is now ready with maximum resources.</p>
            </div>
            <button class="text-indigo-600 hover:text-indigo-800 ml-2">
                <i class="fas fa-times"></i>
            </button>
        </div>

        <!-- Main Content -->
        <div class="bg-white rounded-2xl smooth-shadow overflow-hidden">
            <!-- Status Bar -->
            <div class="bg-gradient-to-r from-indigo-500 to-purple-500 text-white px-6 py-4 flex flex-col sm:flex-row sm:items-center sm:justify-between">
                <div class="flex items-center mb-3 sm:mb-0">
                    <div class="bg-white/20 rounded-full p-2 mr-3">
                        <i class="fas fa-bolt text-yellow-200 text-sm"></i>
                    </div>
                    <div>
                        <h2 class="font-bold text-lg sm:text-xl">AI Assistant Pro</h2>
                        <p class="text-xs text-indigo-100 flex items-center">
                            <span class="inline-block w-2 h-2 bg-green-300 rounded-full mr-1"></span>
                            Active connection
                        </p>
                    </div>
                </div>
                
                <div class="flex items-center space-x-4">
                    <div class="text-center">
                        <p class="text-xs text-indigo-100 mb-1">Session Time</p>
                        <p class="text-sm font-medium">60:00</p>
                    </div>
                    <div class="hidden sm:block h-6 w-px bg-indigo-400"></div>
                    <div class="text-center">
                        <p class="text-xs text-indigo-100 mb-1">Resources</p>
                        <div class="flex items-center">
                            <i class="fas fa-memory text-xs mr-1 text-indigo-100"></i>
                            <p class="text-sm font-medium">150MB</p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Progress Bar -->
            <div class="h-1.5 bg-indigo-100 relative overflow-hidden">
                <div class="progress-bar h-full bg-indigo-500 absolute top-0 left-0"></div>
            </div>

            <!-- Avatar Section -->
            <div class="flex items-center justify-center py-8 px-6">
                <div class="relative">
                    <div class="absolute -inset-4 bg-indigo-500/10 rounded-full blur-lg animate-pulse"></div>
                    <div class="relative bg-white p-5 rounded-full shadow-lg animate-float">
                        <div class="w-24 h-24 bg-gradient-to-br from-indigo-100 to-purple-100 rounded-full flex items-center justify-center">
                            <i class="fas fa-robot text-4xl gradient-text"></i>
                        </div>
                    </div>
                </div>
            </div>

            <div class="px-6 pb-1">
                <h1 class="text-3xl sm:text-4xl font-bold text-center text-gray-800 mb-3">
                    <span class="gradient-text">Ready to Assist</span>
                    <span class="text-gray-500">You!</span>
                </h1>
                <p class="text-gray-500 text-center max-w-2xl mx-auto mb-8">
                    I'm powered up with 150MB of resources to provide you with the best assistance possible.
                    Ask me anything and I'll respond with thoughtful, detailed answers.
                </p>
            </div>

            <!-- Features Section -->
            <div class="grid grid-cols-1 md:grid-cols-3 gap-5 px-6 py-4 bg-gradient-to-b from-indigo-50 to-white">
                <div class="bg-white rounded-xl p-5 card-hover shadow-sm border border-gray-100">
                    <div class="bg-indigo-50 w-12 h-12 rounded-lg flex items-center justify-center mb-4">
                        <i class="fas fa-bolt text-xl text-indigo-500"></i>
                    </div>
                    <h3 class="font-semibold text-lg mb-2 text-gray-800">High-Performance</h3>
                    <p class="text-gray-500 text-sm">Optimized responses with maximum allocated resources</p>
                </div>
                <div class="bg-white rounded-xl p-5 card-hover shadow-sm border border-gray-100">
                    <div class="bg-purple-50 w-12 h-12 rounded-lg flex items-center justify-center mb-4">
                        <i class="fas fa-brain text-xl text-purple-500"></i>
                    </div>
                    <h3 class="font-semibold text-lg mb-2 text-gray-800">Enhanced AI</h3>
                    <p class="text-gray-500 text-sm">More memory means better comprehension and recall</p>
                </div>
                <div class="bg-white rounded-xl p-5 card-hover shadow-sm border border-gray-100">
                    <div class="bg-pink-50 w-12 h-12 rounded-lg flex items-center justify-center mb-4">
                        <i class="fas fa-code text-xl text-pink-500"></i>
                    </div>
                    <h3 class="font-semibold text-lg mb-2 text-gray-800">Code Support</h3>
                    <p class="text-gray-500 text-sm">Full programming assistance with syntax highlighting</p>
                </div>
            </div>

            <!-- Input Section -->
            <div class="px-6 py-6">
                <div class="relative">
                    <textarea 
                        class="w-full px-5 py-4 bg-gray-50 rounded-2xl border-none input-shadow focus:ring-2 focus:ring-indigo-200 focus:border-transparent resize-none"
                        rows="3"
                        placeholder="Ask your question here... (150MB resources allocated)"
                        autofocus
                    ></textarea>
                    <button class="absolute right-4 bottom-4 bg-indigo-500 hover:bg-indigo-600 text-white rounded-xl px-5 py-2 transition-all flex items-center shadow-md hover:shadow-lg">
                        <i class="fas fa-paper-plane mr-2"></i>
                        <span>Send</span>
                    </button>
                </div>
                <p class="text-xs text-gray-400 mt-3 flex items-center">
                    <i class="fas fa-info-circle mr-1.5"></i>
                    Your data and conversations are processed securely with your allocated 150MB resources
                </p>
            </div>
        </div>

        <!-- Footer -->
        <div class="flex flex-col sm:flex-row items-center justify-between mt-6 text-sm text-gray-500">
            <div class="flex items-center mb-3 sm:mb-0">
                <div class="h-3 w-3 rounded-full bg-green-400 mr-2 pulse"></div>
                <span>System status: Operational</span>
            </div>
            <div class="flex items-center space-x-4">
                <a href="#" class="hover:text-indigo-600 transition-colors"><i class="fas fa-shield-alt mr-1"></i> Security</a>
                <a href="#" class="hover:text-indigo-600 transition-colors"><i class="fas fa-cog mr-1"></i> Settings</a>
                <a href="#" class="hover:text-indigo-600 transition-colors"><i class="fas fa-question-circle mr-1"></i> Help</a>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // Update session timer
            function updateTimer() {
                let minutes = 59;
                let seconds = 59;
                
                const timerElement = document.querySelector('.status-timer');
                const timerInterval = setInterval(() => {
                    seconds--;
                    if (seconds < 0) {
                        seconds = 59;
                        minutes--;
                    }
                    
                    if (minutes < 0) {
                        clearInterval(timerInterval);
                    } else {
                        timerElement.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
                    }
                }, 1000);
            }
            
            updateTimer();

            // Textarea auto-resize
            const textarea = document.querySelector('textarea');
            textarea.addEventListener('input', function() {
                this.style.height = 'auto';
                this.style.height = (this.scrollHeight) + 'px';
            });

            // Add decoration to text on hover
            const sendButton = document.querySelector('button');
            sendButton.addEventListener('mouseenter', function() {
                this.innerHTML = '<i class="fas fa-paper-plane mr-2 animate-bounce"></i><span>Send</span>';
            });
            sendButton.addEventListener('mouseleave', function() {
                this.innerHTML = '<i class="fas fa-paper-plane mr-2"></i><span>Send</span>';
            });
        });
    </script>
</body>
</html><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width" />
		<title>My static Space</title>
		<link rel="stylesheet" href="style.css" />
        <script src="https://unpkg.com/es-module-shims@1.7.0/dist/es-module-shims.js"></script>
		<script type="importmap">
			{
				"imports": {
					"@huggingface/hub": "https://cdn.jsdelivr.net/npm/@huggingface/hub@0.21.0/+esm"
				}
			}
		</script>
	</head>
	<body>
      <div class="card" style="margin-bottom: 2rem;">
        <h1>OAuth in a static Space</h1>
        <p>Checkout the <a href="https://huggingface.co/spaces/huggingfacejs/client-side-oauth/blob/main/index.html" target="_blank">index.html</a> file to see the few lines of code
        enabling this space</p>
        <p>After clicking "Signin with HF", you will be redirected to this space and the access token + user info will be displayed.</p>
      </div>
      <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/sign-in-with-huggingface-xl-dark.svg" alt="Sign in with Hugging Face" style="cursor: pointer; display: none;" id="signin">
      <button id="signout" style="display: none">Sign out</button>
      <pre>
        
      </pre>
      <script type="module">
        import { oauthLoginUrl, oauthHandleRedirectIfPresent } from "@huggingface/hub";

        console.log("huggingface env", window.huggingface);

        let oauthResult = localStorage.getItem("oauth");

        if (oauthResult) {
          try {
            oauthResult = JSON.parse(oauthResult);
          } catch {
            oauthResult = null;
          }
        }
        
        oauthResult ||= await oauthHandleRedirectIfPresent();

        if (oauthResult) {
          document.querySelector("pre").textContent = JSON.stringify(oauthResult, null, 2);
          localStorage.setItem("oauth", JSON.stringify(oauthResult));
          document.getElementById("signout").style.removeProperty("display");
          document.getElementById("signout").onclick = async function() {
            localStorage.removeItem("oauth");
            window.location.href = window.location.href.replace(/\?.*$/, '');
            window.location.reload();
          }
        } else {
          document.getElementById("signin").style.removeProperty("display");
          document.getElementById("signin").onclick = async function() {
            // prompt=consent to re-trigger the consent screen instead of silently redirecting
            window.location.href = (await oauthLoginUrl({scopes: window.huggingface.variables.OAUTH_SCOPES})) + "&prompt=consent";
          }
        }
      </script>
	</body>
</html>