-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoc_analysis.html
236 lines (223 loc) · 14.9 KB
/
doc_analysis.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Access-Control-Allow-Origin" content="*">
<meta http-equiv="Content-Security-Policy" content="default-src * 'unsafe-inline' 'unsafe-eval'; script-src * 'unsafe-inline' 'unsafe-eval'; connect-src * 'unsafe-inline'; img-src * data: blob: 'unsafe-inline'; frame-src *; style-src * 'unsafe-inline';">
<title>SmartFileLibrary Database Interface</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!--<link href="bootstrap.min.css" rel="stylesheet">-->
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body onload="startup();">
<svg xmlns="http://www.w3.org/2000/svg" class="d-none">
<symbol id="home" viewBox="0 0 16 16">
<path d="M8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4.5a.5.5 0 0 0 .5-.5v-4h2v4a.5.5 0 0 0 .5.5H14a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146zM2.5 14V7.707l5.5-5.5 5.5 5.5V14H10v-4a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5v4H2.5z"/>
</symbol>
<symbol id="speedometer2" viewBox="0 0 16 16">
<path d="M8 4a.5.5 0 0 1 .5.5V6a.5.5 0 0 1-1 0V4.5A.5.5 0 0 1 8 4zM3.732 5.732a.5.5 0 0 1 .707 0l.915.914a.5.5 0 1 1-.708.708l-.914-.915a.5.5 0 0 1 0-.707zM2 10a.5.5 0 0 1 .5-.5h1.586a.5.5 0 0 1 0 1H2.5A.5.5 0 0 1 2 10zm9.5 0a.5.5 0 0 1 .5-.5h1.5a.5.5 0 0 1 0 1H12a.5.5 0 0 1-.5-.5zm.754-4.246a.389.389 0 0 0-.527-.02L7.547 9.31a.91.91 0 1 0 1.302 1.258l3.434-4.297a.389.389 0 0 0-.029-.518z"/>
<path fill-rule="evenodd" d="M0 10a8 8 0 1 1 15.547 2.661c-.442 1.253-1.845 1.602-2.932 1.25C11.309 13.488 9.475 13 8 13c-1.474 0-3.31.488-4.615.911-1.087.352-2.49.003-2.932-1.25A7.988 7.988 0 0 1 0 10zm8-7a7 7 0 0 0-6.603 9.329c.203.575.923.876 1.68.63C4.397 12.533 6.358 12 8 12s3.604.532 4.923.96c.757.245 1.477-.056 1.68-.631A7 7 0 0 0 8 3z"/>
</symbol>
<symbol id="table" viewBox="0 0 16 16">
<path d="M0 2a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm15 2h-4v3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-.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-3a.5.5 0 0 0-.5-.5h-3z"/>
</symbol>
</svg>
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
<div class="d-flex flex-column flex-shrink-0 p-3" style="width: 280px;">
<div class="d-flex flex-column flex-shrink-0 p-3" style="width: 280px;">
<a href="index.html" class="d-flex align-items-center mb-3 mb-md-0 me-md-auto text-black text-decoration-none">
<img src="icon.svg", width="50px">
<span class="fs-4"> SmartFileLibrary</span>
</a>
<hr>
<ul class="nav nav-pills flex-column mb-auto">
<li class="nav-item">
<a onclick="doswitch()" href="index.html" class="nav-link text-black" aria-current="page">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#home"/></svg>
Home
</a>
</li>
<li>
<a onclick="doswitch()" href="dashboard.html" class="nav-link text-black">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#speedometer2"/></svg>
Dashboard
</a>
</li>
<li>
<a onclick="doswitch()" href="doc_analysis.html" class="nav-link active">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#table"/></svg>
Document Analysis
</a>
</li>
<li>
<a onclick="doswitch()" href="plugins.html" class="nav-link text-black">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#grid"/></svg>
Plugins
</a>
</li>
<li>
<a onclick="doswitch()" href="settings.html" class="nav-link text-black">
<svg class="bi pe-none me-2" width="16" height="16"><use xlink:href="#people-circle"/></svg>
Settings
</a>
</li>
</ul>
<hr>
<div class="dropdown">
<a href="#" class="d-flex align-items-center text-black text-decoration-none dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<img src="https://cdn-icons-png.flaticon.com/512/5705/5705372.png" alt="" width="32" height="32" class="rounded-circle me-2">
<strong id="user-name">Username</strong>
</a>
<ul class="dropdown-menu text-small shadow">
<li><a class="dropdown-item" href="#">New Entry... (TBD)</a></li>
<li><a class="dropdown-item" href="settings.html">Settings</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" onclick="sendServerOff();">Turn off</a></li>
</ul>
</div>
<div style="position: absolute; bottom: 10px;">
<a href="attribution.txt" style="color: grey;"> Icon attribution </a>
</div>
</div>
</div>
</div>
<div id="app">
<button id="menubuttonid" class="btn btn-primary menu-button" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M2.5 11.5A.5.5 0 0 1 3 11h10a.5.5 0 0 1 0 1H2a.5.5 0 0 1-.5-.5zm0-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H2a.5.5 0 0 1-.5-.5zm0-4A.5.5 0 0 1 3 3h10a.5.5 0 0 1 0 1H2a.5.5 0 0 1-.5-.5z"/>
</svg>
</button>
<div id="page-info-container">
<div id="page-info-padding"></div>
<div id="page-info-content">
<br>
<h1><b> Document Analysis </b></h1>
<b> NOTE: SETTING THE MODEL VIA GUI IS NOT YET SUPPORTED. This project is in active development. Please stand by or help by contributing! </b>
<hr>
<h2> Metadata Inference </h2>
<hr>
<p> The fallowing allows you to reconfigure, how <b> metadata </b> about your documents is inferred. This includes title, author, publisher.
<br><br>
<div class="accordion" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="false" aria-controls="collapseOne">
<span id="metadata-usage-field-1"> ✅  </span>PDF metadata  
<div class="settings-info-badge">
<span class="badge rounded-pill bg-success text-light">efficient</span>
<span>   </span>
<span class="badge rounded-pill bg-warning text-dark">unreliable</span>
</div>
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
This option infers the title, etc. based only on the PDF's metadata. It is important to check back to see the output before committing the changes to the library. While efficient, this method is approximate. There are likely mistakes. <br><br>
Optionally, this process can be augmented with the Crossref database. This only works for scientific documents. The assumption is that the PDF is named after the ISBN for now. That way, it can look up the relevant information.
<br><br>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="useCrossRefCheck">
<label class="form-check-label" for="flexCheckDefault">
Use crossref to look up metadata.
</label>
</div>
<br><br>
<button type="button" onclick="setMetadataModel(1);" class="btn btn-success">Enable</button>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingTwo">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
<span id="metadata-usage-field-2"> </span>Donut model  
<div class="settings-info-badge">
<span class="badge rounded-pill bg-success text-light"> efficient </span>
<span>   </span>
<span class="badge rounded-pill bg-warning text-dark">incomplete</span>
</div>
</button>
</h2>
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
<div class="accordion-body">
This uses a <a href="https://huggingface.co/naver-clova-ix/donut-base-finetuned-docvqa"> donut model finetuned on DocVQA.</a>.
It's peak memory usage is around 3 GB. However, it is fairly inaccurate and struggles with information that is written accross multiple lines. If possible, it is recommended to use the Idefics 2 model. See next option.
<br><br>
<button type="button" onclick="setMetadataModel(2);" class="btn btn-success">Enable</button>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingThree">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
<span>   </span>Idefics2-8b model  
<div class="settings-info-badge">
<span class="badge rounded-pill bg-success text-light">accurate</span>
<span>   </span>
<span class="badge rounded-pill bg-warning text-dark">high compute</span>
</div>
</button>
</h2>
<div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample">
<div class="accordion-body">
This is the best open source option right now. This option is in development. Please stand by.
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header" id="headingFour">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
<span>   </span>ChatGPT-V  
<div class="settings-info-badge">
<span class="badge rounded-pill bg-success text-light">accurate</span>
<span>   </span>
<span class="badge rounded-pill bg-warning text-dark">costs $$$</span>
<span>   </span>
<span class="badge rounded-pill bg-warning text-dark"> privacy </span>
</div>
</button>
</h2>
<div id="collapseFour" class="accordion-collapse collapse" aria-labelledby="headingFour" data-bs-parent="#accordionExample">
<div class="accordion-body">
The option is not yet supported.
</div>
</div>
</div>
</div>
<br><br>
<h2> Keywords inference </h2>
<hr>
<p> This is how the keywords are inferred. This option cannot be modified yet.
</div>
<div id="page-info-padding-right"></div>
</div>
</div>
<div id="disclaimer">
SmartFileLibrary - This project is in active devlopment.
</div>
<!-- Status disclaimer -->
<div id="status-disclaimer" class="status-disclaimer">
<span id="status-circle-id" class="status-circle status-running"></span>
<a id="status-disclaimer-text">Server running</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>-
<!--<script src="bootstrap.bundle.min.js.js"></script>-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<!--<script src="vue.js.js"></script>-->
<script src="run.js"></script>
<script type="text/javascript">
function startup(){
checkServerStatus();
getUserName();
}
</script>
<noscript>No Js...</noscript>
</body>
</html>