Marthee commited on
Commit
39301a8
·
verified ·
1 Parent(s): a9dcdd8

Update templates/gui.html

Browse files
Files changed (1) hide show
  1. templates/gui.html +48 -0
templates/gui.html CHANGED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 NBS Search - ADR MVP.1</title>
7
+ </head>
8
+ <body>
9
+ </body>
10
+ </html>
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.14.305/pdf.min.js"></script>
12
+ <script >
13
+
14
+ ///////////////////////////////////////////////BEGIN JS CODE//////////////////////////////////////////////////
15
+ // Function to send the Dropbox link and keyword to the server
16
+ function processPdf() {
17
+ const pdfLink = 'https://www.dropbox.com/scl/fi/hnp4mqigb51a5kp89kgfa/00801-ARC-20-ZZ-S-A-0002.pdf?rlkey=45abeoebzqw4qwnslnei6dkd6&st=m4yrcjm2&dl=1'; // Dropbox link
18
+ const keyword = ['115 INTEGRATED MRI ROOM LININGS'] ; // Example keyword
19
+
20
+ // Create a new FormData object to send the data as form data
21
+ const formData = new FormData();
22
+ formData.append('pdf_link', pdfLink);
23
+ formData.append('keyword', JSON.stringify(keyword));
24
+
25
+ // Send the data to the Flask server
26
+ fetch('/api/process-data', {
27
+ method: 'POST',
28
+ body: formData,
29
+ })
30
+ .then(response => response.json())
31
+ .then(data => {
32
+ // Handle the server's response
33
+ if (data.download_link) {
34
+ // Redirect the user to the page where the annotation is located
35
+ // The download_link includes both the page number and the rect (coordinates)
36
+ window.location.href = data.download_link; // This will use the rect info from Flask
37
+ } else {
38
+ alert('Error: ' + data.error);
39
+ }
40
+ })
41
+ .catch(error => {
42
+ console.error('Error:', error);
43
+ });
44
+ }
45
+
46
+ // Call the function to process the PDF
47
+ processPdf();
48
+ </script>