EmilyWitko HF staff commited on
Commit
1d0deab
1 Parent(s): 70bbd69

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +38 -5
index.html CHANGED
@@ -15,10 +15,9 @@
15
  h1 {
16
  color: #2c3e50;
17
  }
18
- .container {
19
- text-align: center;
20
- }
21
- iframe {
22
  border: 1px solid #ddd;
23
  }
24
  </style>
@@ -26,7 +25,41 @@
26
  <body>
27
  <div class="container">
28
  <h1>Unconscious Bias Training</h1>
29
- <iframe src="https://huggingface.co/spaces/EmilyWitko/Unconscious_Bias/raw/main/Training%20%232_%20Unconscious%20Bias.pdf" width="1000" height="800"></iframe>
30
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </body>
32
  </html>
 
15
  h1 {
16
  color: #2c3e50;
17
  }
18
+ #pdf-viewer {
19
+ width: 100%;
20
+ height: 800px;
 
21
  border: 1px solid #ddd;
22
  }
23
  </style>
 
25
  <body>
26
  <div class="container">
27
  <h1>Unconscious Bias Training</h1>
28
+ <canvas id="pdf-viewer"></canvas>
29
  </div>
30
+ <script src="pdf.js"></script>
31
+ <script src="pdf.worker.js"></script>
32
+ <script>
33
+ const url = 'https://huggingface.co/spaces/EmilyWitko/Unconscious_Bias/raw/main/Training%20%232_%20Unconscious%20Bias.pdf';
34
+
35
+ const loadingTask = pdfjsLib.getDocument(url);
36
+ loadingTask.promise.then(function(pdf) {
37
+ console.log('PDF loaded');
38
+
39
+ const pageNumber = 1;
40
+ pdf.getPage(pageNumber).then(function(page) {
41
+ console.log('Page loaded');
42
+
43
+ const scale = 1.5;
44
+ const viewport = page.getViewport({scale: scale});
45
+
46
+ const canvas = document.getElementById('pdf-viewer');
47
+ const context = canvas.getContext('2d');
48
+ canvas.height = viewport.height;
49
+ canvas.width = viewport.width;
50
+
51
+ const renderContext = {
52
+ canvasContext: context,
53
+ viewport: viewport
54
+ };
55
+ const renderTask = page.render(renderContext);
56
+ renderTask.promise.then(function () {
57
+ console.log('Page rendered');
58
+ });
59
+ });
60
+ }, function (reason) {
61
+ console.error(reason);
62
+ });
63
+ </script>
64
  </body>
65
  </html>