akhaliq HF Staff commited on
Commit
1b82fc0
·
verified ·
1 Parent(s): 2b9cdbb

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +398 -19
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>PDF Reader</title>
7
+ <script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/build/pdf.min.js"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ * {
11
+ margin: 0;
12
+ padding: 0;
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ body {
17
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
18
+ background-color: #f8f9fa;
19
+ color: #333;
20
+ line-height: 1.6;
21
+ }
22
+
23
+ .header {
24
+ background-color: #2c3e50;
25
+ color: white;
26
+ padding: 1rem 2rem;
27
+ display: flex;
28
+ justify-content: space-between;
29
+ align-items: center;
30
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
31
+ }
32
+
33
+ .logo {
34
+ display: flex;
35
+ align-items: center;
36
+ gap: 0.5rem;
37
+ text-decoration: none;
38
+ color: white;
39
+ font-weight: 600;
40
+ font-size: 1.1rem;
41
+ }
42
+
43
+ .logo i {
44
+ font-size: 1.3rem;
45
+ }
46
+
47
+ .nav-links {
48
+ display: flex;
49
+ gap: 1.5rem;
50
+ align-items: center;
51
+ }
52
+
53
+ .nav-links a {
54
+ color: white;
55
+ text-decoration: none;
56
+ font-weight: 500;
57
+ transition: opacity 0.2s;
58
+ }
59
+
60
+ .nav-links a:hover {
61
+ opacity: 0.8;
62
+ }
63
+
64
+ .nav-links .btn {
65
+ background-color: #3498db;
66
+ padding: 0.5rem 1rem;
67
+ border-radius: 4px;
68
+ transition: background-color 0.2s;
69
+ }
70
+
71
+ .nav-links .btn:hover {
72
+ background-color: #2980b9;
73
+ }
74
+
75
+ .main-content {
76
+ padding: 2rem;
77
+ max-width: 1200px;
78
+ margin: 0 auto;
79
+ }
80
+
81
+ .pdf-container {
82
+ background-color: white;
83
+ border-radius: 8px;
84
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
85
+ overflow: hidden;
86
+ margin-bottom: 2rem;
87
+ }
88
+
89
+ .pdf-viewer {
90
+ width: 100%;
91
+ height: 80vh;
92
+ overflow: auto;
93
+ background-color: #f5f5f5;
94
+ position: relative;
95
+ }
96
+
97
+ .pdf-page {
98
+ width: 100%;
99
+ margin-bottom: 1rem;
100
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
101
+ background-color: white;
102
+ }
103
+
104
+ .pdf-page img {
105
+ width: 100%;
106
+ display: block;
107
+ }
108
+
109
+ .loading {
110
+ display: flex;
111
+ justify-content: center;
112
+ align-items: center;
113
+ height: 100%;
114
+ font-size: 1.2rem;
115
+ color: #666;
116
+ }
117
+
118
+ .controls {
119
+ display: flex;
120
+ justify-content: center;
121
+ gap: 1rem;
122
+ margin: 1rem 0;
123
+ flex-wrap: wrap;
124
+ }
125
+
126
+ .controls button {
127
+ background-color: #3498db;
128
+ color: white;
129
+ border: none;
130
+ padding: 0.5rem 1rem;
131
+ border-radius: 4px;
132
+ cursor: pointer;
133
+ font-weight: 500;
134
+ transition: background-color 0.2s;
135
+ }
136
+
137
+ .controls button:hover {
138
+ background-color: #2980b9;
139
+ }
140
+
141
+ .controls button:disabled {
142
+ background-color: #95a5a6;
143
+ cursor: not-allowed;
144
+ }
145
+
146
+ .footer {
147
+ background-color: #2c3e50;
148
+ color: white;
149
+ text-align: center;
150
+ padding: 1.5rem;
151
+ margin-top: 2rem;
152
+ }
153
+
154
+ .footer-content {
155
+ max-width: 1200px;
156
+ margin: 0 auto;
157
+ display: flex;
158
+ justify-content: space-between;
159
+ align-items: center;
160
+ flex-wrap: wrap;
161
+ gap: 1rem;
162
+ }
163
+
164
+ .footer-links {
165
+ display: flex;
166
+ gap: 1rem;
167
+ }
168
+
169
+ .footer-links a {
170
+ color: white;
171
+ text-decoration: none;
172
+ opacity: 0.8;
173
+ transition: opacity 0.2s;
174
+ }
175
+
176
+ .footer-links a:hover {
177
+ opacity: 1;
178
+ }
179
+
180
+ .anycoder-link {
181
+ color: #3498db;
182
+ text-decoration: none;
183
+ font-weight: 500;
184
+ }
185
+
186
+ .anycoder-link:hover {
187
+ text-decoration: underline;
188
+ }
189
+
190
+ @media (max-width: 768px) {
191
+ .header {
192
+ flex-direction: column;
193
+ gap: 1rem;
194
+ padding: 1rem;
195
+ }
196
+
197
+ .nav-links {
198
+ flex-wrap: wrap;
199
+ justify-content: center;
200
+ gap: 1rem;
201
+ }
202
+
203
+ .main-content {
204
+ padding: 1rem;
205
+ }
206
+
207
+ .pdf-viewer {
208
+ height: 70vh;
209
+ }
210
+
211
+ .footer-content {
212
+ flex-direction: column;
213
+ text-align: center;
214
+ }
215
+ }
216
+
217
+ @media (max-width: 480px) {
218
+ .header {
219
+ padding: 0.75rem;
220
+ }
221
+
222
+ .nav-links {
223
+ gap: 0.75rem;
224
+ }
225
+
226
+ .controls {
227
+ gap: 0.5rem;
228
+ }
229
+
230
+ .controls button {
231
+ padding: 0.4rem 0.8rem;
232
+ font-size: 0.9rem;
233
+ }
234
+ }
235
+ </style>
236
+ </head>
237
+ <body>
238
+ <header class="header">
239
+ <a href="#" class="logo">
240
+ <i class="fas fa-file-pdf"></i>
241
+ <span>PDF Reader</span>
242
+ </a>
243
+ <nav class="nav-links">
244
+ <a href="#">Home</a>
245
+ <a href="#">About</a>
246
+ <a href="#" class="btn">Contact</a>
247
+ <a href="https://huggingface.co/spaces/akhaliq/anycoder" class="anycoder-link" target="_blank">Built with anycoder</a>
248
+ </nav>
249
+ </header>
250
+
251
+ <main class="main-content">
252
+ <div class="pdf-container">
253
+ <div class="pdf-viewer" id="pdfViewer">
254
+ <div class="loading">Loading PDF...</div>
255
+ </div>
256
+ <div class="controls">
257
+ <button id="prevPage" disabled>Previous</button>
258
+ <span id="pageInfo">Page 1</span>
259
+ <button id="nextPage">Next</button>
260
+ </div>
261
+ </div>
262
+ </main>
263
+
264
+ <footer class="footer">
265
+ <div class="footer-content">
266
+ <div>
267
+ <p>&copy; 2024 PDF Reader. All rights reserved.</p>
268
+ </div>
269
+ <div class="footer-links">
270
+ <a href="#">Privacy Policy</a>
271
+ <a href="#">Terms of Service</a>
272
+ <a href="#">Contact</a>
273
+ </div>
274
+ </div>
275
+ </footer>
276
+
277
+ <script>
278
+ // Initialize PDF.js
279
+ pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdn.jsdelivr.net/npm/pdfjs-dist@2.12.313/build/pdf.worker.min.js';
280
+
281
+ // PDF URL
282
+ const pdfUrl = 'https://cdn.openai.com/pdf/3a4153c8-c748-4b71-8e31-aecbde944f8d/oai_5_2_system-card.pdf';
283
+
284
+ // DOM elements
285
+ const pdfViewer = document.getElementById('pdfViewer');
286
+ const prevPageBtn = document.getElementById('prevPage');
287
+ const nextPageBtn = document.getElementById('nextPage');
288
+ const pageInfo = document.getElementById('pageInfo');
289
+
290
+ // PDF variables
291
+ let pdfDoc = null;
292
+ let pageNum = 1;
293
+ let pageRendering = false;
294
+ let pageNumPending = null;
295
+ let scale = 1.5;
296
+ let canvas = null;
297
+ let ctx = null;
298
+
299
+ // Load the PDF document
300
+ pdfjsLib.getDocument(pdfUrl).promise.then(function(pdf) {
301
+ pdfDoc = pdf;
302
+ document.querySelector('.loading').style.display = 'none';
303
+ renderPage(pageNum);
304
+ updatePageInfo();
305
+ }).catch(function(error) {
306
+ document.querySelector('.loading').textContent = 'Error loading PDF: ' + error.message;
307
+ });
308
+
309
+ // Render a specific page
310
+ function renderPage(num) {
311
+ pageRendering = true;
312
+
313
+ pdfDoc.getPage(num).then(function(page) {
314
+ // Create canvas if it doesn't exist
315
+ if (!canvas) {
316
+ canvas = document.createElement('canvas');
317
+ ctx = canvas.getContext('2d');
318
+ pdfViewer.appendChild(canvas);
319
+ }
320
+
321
+ const viewport = page.getViewport({ scale: scale });
322
+ canvas.height = viewport.height;
323
+ canvas.width = viewport.width;
324
+
325
+ // Render PDF page into canvas context
326
+ const renderContext = {
327
+ canvasContext: ctx,
328
+ viewport: viewport
329
+ };
330
+
331
+ const renderTask = page.render(renderContext);
332
+
333
+ renderTask.promise.then(function() {
334
+ pageRendering = false;
335
+ if (pageNumPending !== null) {
336
+ renderPage(pageNumPending);
337
+ pageNumPending = null;
338
+ }
339
+ });
340
+ });
341
+ }
342
+
343
+ // Go to previous page
344
+ prevPageBtn.addEventListener('click', function() {
345
+ if (pageNum <= 1) return;
346
+ pageNum--;
347
+ queueRenderPage(pageNum);
348
+ updatePageInfo();
349
+ });
350
+
351
+ // Go to next page
352
+ nextPageBtn.addEventListener('click', function() {
353
+ if (pageNum >= pdfDoc.numPages) return;
354
+ pageNum++;
355
+ queueRenderPage(pageNum);
356
+ updatePageInfo();
357
+ });
358
+
359
+ // Queue page rendering
360
+ function queueRenderPage(num) {
361
+ if (pageRendering) {
362
+ pageNumPending = num;
363
+ } else {
364
+ renderPage(num);
365
+ }
366
+ }
367
+
368
+ // Update page info display
369
+ function updatePageInfo() {
370
+ pageInfo.textContent = `Page ${pageNum} of ${pdfDoc ? pdfDoc.numPages : '?'}`;
371
+ prevPageBtn.disabled = pageNum <= 1;
372
+ nextPageBtn.disabled = pageNum >= (pdfDoc ? pdfDoc.numPages : 1);
373
+ }
374
+
375
+ // Keyboard navigation
376
+ document.addEventListener('keydown', function(e) {
377
+ if (e.key === 'ArrowLeft' && pageNum > 1) {
378
+ pageNum--;
379
+ queueRenderPage(pageNum);
380
+ updatePageInfo();
381
+ } else if (e.key === 'ArrowRight' && pageNum < (pdfDoc ? pdfDoc.numPages : 1)) {
382
+ pageNum++;
383
+ queueRenderPage(pageNum);
384
+ updatePageInfo();
385
+ }
386
+ });
387
+
388
+ // Make the PDF viewer responsive
389
+ function handleResize() {
390
+ if (pdfDoc) {
391
+ renderPage(pageNum);
392
+ }
393
+ }
394
+
395
+ window.addEventListener('resize', handleResize);
396
+ </script>
397
+ </body>
398
+ </html>