Scezui commited on
Commit
247a2c8
1 Parent(s): d6bb931

Update templates/extractor.html

Browse files
Files changed (1) hide show
  1. templates/extractor.html +196 -258
templates/extractor.html CHANGED
@@ -16,7 +16,7 @@
16
 
17
  <!--Icon Fonts - Font Awesome Icons-->
18
  <link rel="stylesheet" href="/static/css/font-awesome.min.css">
19
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css">
20
  <!-- Animate CSS-->
21
  <link href="css/animate.css" rel="stylesheet" type="text/css">
22
 
@@ -27,6 +27,10 @@
27
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600&display=swap" rel="stylesheet">
28
  <title>ExCeipt | Extractor</title>
29
  <style>
 
 
 
 
30
  .containerz {
31
  display: flex;
32
  width: 100vw;
@@ -48,7 +52,8 @@
48
  flex: 2;
49
  background-color: #ffffff;
50
  padding: 20px;
51
- overflow: auto; /* or 'visible' or 'scroll' */
 
52
  }
53
 
54
  .backbutton {
@@ -131,7 +136,7 @@
131
  margin-right: 5px;
132
  }
133
 
134
- .bordered-table tbody td.full-width input {
135
  flex-grow: 1;
136
  }
137
 
@@ -156,21 +161,24 @@
156
  height: 25%;
157
  padding: 10px 10px 10px 10px;
158
  }
159
-
160
  .receipt {
161
  margin: 20px 20px;
162
  border: 1px solid #ccc;
163
  border-radius: 10px;
164
- font:14px;
165
  }
 
166
  .receipt1 {
167
  margin: 20px 20px;
168
- font:14px;
169
  }
 
170
  .receipt1 table {
171
- border-radius:10px;
172
  }
173
- .filenm{
 
174
  padding: 1em 1.8em;
175
  box-sizing: border-box;
176
  border-radius: 10px;
@@ -184,7 +192,7 @@
184
  font-size: 14px;
185
  font-weight: 300;
186
  }
187
-
188
  .receipt h1 {
189
  text-align: center;
190
  }
@@ -214,8 +222,9 @@
214
  text-align: right;
215
  font-weight: bold;
216
  }
 
217
  #dataTable {
218
- border-radius:10px;
219
  border-collapse: collapse;
220
  width: 100%;
221
  width: 100%;
@@ -223,17 +232,22 @@
223
  table-layout: fixed;
224
  overflow-x: auto;
225
  }
226
- #receiptdiv{
 
227
  display: none;
228
  }
229
- #dataTable th, #dataTable td {
 
 
230
  font-size: 12px;
231
  text-align: center;
232
  padding: 3px;
233
  }
 
234
  #downloadbutton {
235
  display: none;
236
  }
 
237
  #loadingSpinner {
238
  position: relative;
239
  top: 20%;
@@ -245,266 +259,190 @@
245
  width: 30px;
246
  height: 30px;
247
  animation: spin 1s linear infinite;
248
- display: none; /* Hide initially */
 
249
  }
250
-
251
  @keyframes spin {
252
- 0% { transform: rotate(0deg); }
253
- 100% { transform: rotate(360deg); }
 
 
 
 
254
  }
 
255
  #uploadbutton:disabled {
256
  cursor: not-allowed;
257
  background-color: #dddddd;
258
  }
 
259
  .labels {
260
  margin: 0 0 0 20px;
261
  font-weight: 500;
262
  }
263
- .labels p{
 
264
  font-size: 14px;
265
  padding-top: 8px;
266
- line-height: 15px;
267
- color:ccc;
 
 
268
  }
269
- #filenm{
 
270
  position: relative;
271
- z-index:999;
272
- }
273
- .valid{
274
- padding-left:8px;
275
- font-weight:300;
276
- font-size:14px;
277
- }
278
- .details1{
279
- border-radius:10px;
280
- z-index:-1;
281
- }
282
-
283
- </style>
284
- <script src="https://cdn.lordicon.com/lordicon.js"></script>
285
- </head>
286
-
287
- <body>
288
- <!-- Preloader -->
289
- <div id="preloader">
290
- <div class="ocrloader" id="status">
291
- <em></em>
292
- <div>
293
- <i></i><i></i><i></i><i></i><i></i><i></i><i></i>
294
- <i></i><i></i><i></i><i></i><i></i><i></i><i></i>
295
- <i></i><i></i><i></i>
296
- </div>
297
- <span></span>
298
- </div>
299
- </div>
300
- <!--End of Preloader-->
301
- <div id="flash-container" class="alert alert-danger" role="alert">
302
- <!-- Flash message will be displayed here -->
303
- </div>
304
- <div class="containerz">
305
-
306
- <div class="left-column">
307
- <button class="backbutton" id="submitButton" onclick="window.location.href='{{ url_for('index') }}'">
308
- <i class="fa-solid fa-arrow-left"></i>
309
- <span>Back</span>
310
- </button>
311
- <div id="filenm">
312
- <div style="display: flex; align-items: center; position: absolute; top: 10px; right: 0;">
313
- <span class="filenm">
314
- <lord-icon
315
- src="https://cdn.lordicon.com/xpgofwru.json"
316
- trigger="in"
317
- delay ="500"
318
- state="hover-file-2"
319
- colors="primary:#ff8b4a"
320
- style="width:20px;height:20px">
321
- </lord-icon>
322
- {{ old_name }}</span>
323
- </button>
324
- </div>
325
- </div>
326
-
327
-
328
- <div id="canvas-container">
329
- <canvas id="c3"></canvas>
330
- {% if uploaded_file %}
331
- <img src="{{ url_for('static', filename='uploads/' + uploaded_file) }}" id="my-image" hidden>
332
- {% else %}
333
- <p>No file uploaded.</p>
334
- {% endif %}
335
-
336
- </div>
337
- </div>
338
- <div class="right-column">
339
- <div id="logox">
340
- <img src="/static/images/logo.png" id="banner-logo" alt="Landing Page" />
341
- </div>
342
-
343
- <div style="display: flex; align-items: center;">
344
- </div>
345
- <hr style="color: #ccc; width:95%; opacity:0.35;">
346
- <div class="labels" style="margin: 0 0 0 20px;"><p>Receipt Verification</p></div>
347
- <div class="receipt">
348
- <div class="details">
349
- <div style="display: flex; align-items: center;">
350
- {% if prediction_result == 'receipt' %}
351
- <lord-icon
352
- src="https://cdn.lordicon.com/lomfljuq.json"
353
- trigger="in"
354
- delay="1500"
355
- colors="primary:#16c72e"
356
- state="morph-check-in-1"
357
- style="width:25px;height:25px">
358
- </lord-icon>
359
- <p class="valid">The image uploaded is a Valid Receipt.</p>
360
- {% else %}
361
- <lord-icon
362
- src="https://cdn.lordicon.com/zxvuvcnc.json"
363
- trigger="in"
364
- delay="1500"
365
- state="morph-cross-in"
366
- colors="primary:#e83a30"
367
- style="width:25px;height:25px">
368
- </lord-icon>
369
- <p class="valid">The image uploaded is NOT a Receipt Please return and upload again.</p>
370
- {% endif %}
371
- </div>
372
- </div>
373
- </div>
374
- <hr style="color: #ccc; width:95%; opacity:0.35;">
375
- <div class="labels"><p>Text Extraction</p></div>
376
- <div style="text-align: center;">
377
- <a href="{{ url_for('run_inference') }}">
378
- <button id="uploadbutton" class="uploadbutton" type="submit">Extract</button>
379
- </a>
380
- </div>
381
- <div class="loader" id="loader">
382
- <em></em>
383
- <div>
384
- <i></i><i></i><i></i><i></i><i></i><i></i><i></i>
385
- <i></i><i></i><i></i><i></i><i></i><i></i><i></i>
386
- <i></i><i></i><i></i>
387
- </div>
388
- <span></span>
389
- </div>
390
- <div class="receipt1" id="receiptdiv">
391
- <div class="details1">
392
- <table id="dataTable" border="1">
393
- <thead>
394
- <tr>
395
- <th>Receipt No.</th>
396
- <th>Merchant</th>
397
- <th>Address</th>
398
- <th>Date</th>
399
- <th>Time</th>
400
- <th>Items</th>
401
- <th>Price</th>
402
- <th>Total</th>
403
- <th>Vat Tax</th>
404
- </tr>
405
- </thead>
406
- <tbody>
407
- </tbody>
408
- </table>
409
- </div>
410
- </div>
411
- <hr style="color: #ccc; width:95%; opacity:0.35;">
412
- <div class="labels" style="margin: 0 0 0 20px;"><p>Export</p></div>
413
- <div style="text-align: center;">
414
- <a href="{{ url_for('download_csv') }}">
415
- <button id="downloadbutton" class="uploadbutton" type="submit">Export CSV</button>
416
- </a>
417
- </div>
418
- </div>
419
-
420
- <a href="https://lordicon.com/" hidden >Icons by Lordicon.com</a>
421
- <script>
422
-
423
- document.addEventListener('DOMContentLoaded', function() {
424
- const dataTable = document.getElementById('receiptdiv');
425
- const loadingSpinner = document.getElementById('loader');
426
- const runInferenceButton = document.getElementById('uploadbutton');
427
- const exportCSVButton = document.getElementById('downloadbutton');
428
-
429
- document.getElementById('uploadbutton').addEventListener('click', function() {
430
- loadingSpinner.style.display = 'inline-block'; // Show loading spinner
431
- runInferenceButton.disabled = true;
432
- runInference();
433
- });
434
-
435
-
436
-
437
- async function runInference() {
438
- await fetch('/run_inference');
439
-
440
- setTimeout(function() {
441
- loadingSpinner.style.display = 'none';
442
- runInferenceButton.style.display = 'none';
443
- exportCSVButton.style.display = 'inline-block';
444
-
445
- getData();
446
- }, 500);
447
  }
448
-
449
- async function getData() {
450
- const response = await fetch('/get_data');
451
- const data = await response.text();
452
-
453
- updateTable(data);
454
-
455
- // Show the table when data is updated
456
- dataTable.style.display = 'table';
457
  }
458
- function updateTable(data) {
459
- const table = data.split('\n').map(row => row.trim()).filter(Boolean).slice(1);
460
- const tbody = document.querySelector('#dataTable tbody');
461
- tbody.innerHTML = ''; // Clear existing rows
462
-
463
- table.forEach(row => {
464
- const column = row.split('|');
465
- const RECEIPTNUMBER = column[0] || ''; // Set to an empty string if undefined
466
- const MERCHANTNAME = column[1] || '';
467
- const MERCHANTADDRESS = column[2] || '';
468
- const TRANSACTIONDATE = column[3] || '';
469
- const TRANSACTIONTIME = column[4] || '';
470
- const ITEMS = column[5] || '';
471
- const PRICE = column[6] || '';
472
- const TOTAL = column[7] || '';
473
- const VATTAX = column[8] || '';
474
-
475
- const tr = document.createElement('tr');
476
- tr.innerHTML = `
477
- <td contenteditable="true">${RECEIPTNUMBER}</td>
478
- <td contenteditable="true">${MERCHANTNAME}</td>
479
- <td contenteditable="true">${MERCHANTADDRESS}</td>
480
- <td contenteditable="true">${TRANSACTIONDATE}</td>
481
- <td contenteditable="true">${TRANSACTIONTIME}</td>
482
- <td contenteditable="true">${ITEMS}</td>
483
- <td contenteditable="true">${PRICE}</td>
484
- <td contenteditable="true">${TOTAL}</td>
485
- <td contenteditable="true">${VATTAX}</td>
486
- `;
487
- tbody.appendChild(tr);
488
- });
489
- }
490
- });
491
- </script>
492
-
493
- <!-- Include JavaScript resources -->
494
- <script src="/static/js/jquery.1.8.3.min.js"></script>
495
- <script src="/static/js/wow.min.js"></script>
496
- <script src="/static/js/featherlight.min.js"></script>
497
- <script src="/static/js/featherlight.gallery.min.js"></script>
498
- <script src="/static/js/jquery.enllax.min.js"></script>
499
- <script src="/static/js/jquery.scrollUp.min.js"></script>
500
- <script src="/static/js/jquery.easing.min.js"></script>
501
- <script src="/static/js/jquery.stickyNavbar.min.js"></script>
502
- <script src="/static/js/jquery.waypoints.min.js"></script>
503
- <script src="/static/js/images-loaded.min.js"></script>
504
- <script src="/static/js/lightbox.min.js"></script>
505
- <script src="/static/js/site.js"></script>
506
- <script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/4.5.0/fabric.min.js"></script>
507
-
508
- </body>
509
-
510
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  <!--Icon Fonts - Font Awesome Icons-->
18
  <link rel="stylesheet" href="/static/css/font-awesome.min.css">
19
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
20
  <!-- Animate CSS-->
21
  <link href="css/animate.css" rel="stylesheet" type="text/css">
22
 
 
27
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600&display=swap" rel="stylesheet">
28
  <title>ExCeipt | Extractor</title>
29
  <style>
30
+ body {
31
+ background-color: #ddd;
32
+ }
33
+
34
  .containerz {
35
  display: flex;
36
  width: 100vw;
 
52
  flex: 2;
53
  background-color: #ffffff;
54
  padding: 20px;
55
+ overflow-y: auto;
56
+ max-height: 100vh;
57
  }
58
 
59
  .backbutton {
 
136
  margin-right: 5px;
137
  }
138
 
139
+ .bordered-table tbody td .full-width input {
140
  flex-grow: 1;
141
  }
142
 
 
161
  height: 25%;
162
  padding: 10px 10px 10px 10px;
163
  }
164
+
165
  .receipt {
166
  margin: 20px 20px;
167
  border: 1px solid #ccc;
168
  border-radius: 10px;
169
+ font: 14px;
170
  }
171
+
172
  .receipt1 {
173
  margin: 20px 20px;
174
+ font: 14px;
175
  }
176
+
177
  .receipt1 table {
178
+ border-radius: 10px;
179
  }
180
+
181
+ .filenm {
182
  padding: 1em 1.8em;
183
  box-sizing: border-box;
184
  border-radius: 10px;
 
192
  font-size: 14px;
193
  font-weight: 300;
194
  }
195
+
196
  .receipt h1 {
197
  text-align: center;
198
  }
 
222
  text-align: right;
223
  font-weight: bold;
224
  }
225
+
226
  #dataTable {
227
+ border-radius: 10px;
228
  border-collapse: collapse;
229
  width: 100%;
230
  width: 100%;
 
232
  table-layout: fixed;
233
  overflow-x: auto;
234
  }
235
+
236
+ #receiptdiv {
237
  display: none;
238
  }
239
+
240
+ #dataTable th,
241
+ #dataTable td {
242
  font-size: 12px;
243
  text-align: center;
244
  padding: 3px;
245
  }
246
+
247
  #downloadbutton {
248
  display: none;
249
  }
250
+
251
  #loadingSpinner {
252
  position: relative;
253
  top: 20%;
 
259
  width: 30px;
260
  height: 30px;
261
  animation: spin 1s linear infinite;
262
+ display: none;
263
+ /* Hide initially */
264
  }
265
+
266
  @keyframes spin {
267
+ 0% {
268
+ transform: rotate(0deg);
269
+ }
270
+ 100% {
271
+ transform: rotate(360deg);
272
+ }
273
  }
274
+
275
  #uploadbutton:disabled {
276
  cursor: not-allowed;
277
  background-color: #dddddd;
278
  }
279
+
280
  .labels {
281
  margin: 0 0 0 20px;
282
  font-weight: 500;
283
  }
284
+
285
+ .labels p {
286
  font-size: 14px;
287
  padding-top: 8px;
288
+ line-height: 5px;
289
+ color: ccc;
290
+ padding: 8px 0 0 0;
291
+ text-align: left;
292
  }
293
+
294
+ #filenm {
295
  position: relative;
296
+ z-index: 999;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
297
  }
298
+
299
+ .valid {
300
+ padding-left: 8px;
301
+ font-weight: 300;
302
+ font-size: 14px;
 
 
 
 
303
  }
304
+
305
+ .details1 {
306
+ border-radius: 10px;
307
+ z-index: -1;
308
+ }
309
+
310
+ .exportbutton {
311
+ margin-right: 17px;
312
+ box-sizing: border-box;
313
+ border-radius: 10px;
314
+ padding: 1em 1.8em;
315
+ display: flex;
316
+ transition: 0.2s background;
317
+ align-items: center;
318
+ gap: 0.6em;
319
+ font-weight: 400;
320
+ background: linear-gradient(45deg, #FF6347, #FFA07A);
321
+ backdrop-filter: blur(10px);
322
+ border: 2px solid transparent;
323
+ color: white;
324
+ cursor: pointer;
325
+ }
326
+
327
+ .exportbutton:hover {
328
+ border: 2px solid #FF8B4A;
329
+ background: #f5f5f5;
330
+ color: #000;
331
+ transition: all .3s ease-in-out;
332
+ }
333
+
334
+ @media (max-width: 1024px) {
335
+ .filenm {
336
+ border-radius: 10px;
337
+ gap: 0.3em;
338
+ font-size: 9px;
339
+ padding: 9px 11px;
340
+ margin: 0;
341
+ }
342
+ .filenm span {
343
+ text-overflow: ellipsis;
344
+ white-space: nowrap;
345
+ overflow: hidden;
346
+ }
347
+ .backbutton span {
348
+ font-size: 9px;
349
+ }
350
+ .backbutton {
351
+ padding: 12px 14px;
352
+ border-radius: 10px;
353
+ }
354
+ .receipt {
355
+ margin: 15px 15px;
356
+ }
357
+ p {
358
+ padding: 10px;
359
+ font-size: 13px;
360
+ }
361
+ p.desc {
362
+ font-size: 8px;
363
+ text-align: left;
364
+ }
365
+ .labels {
366
+ text-align: left;
367
+ }
368
+ .labels p {
369
+ padding: 8px 0 8px 0;
370
+ }
371
+ .avatargif img {
372
+ margin-top: 1.5em;
373
+ }
374
+ }
375
+
376
+ @media (max-width: 768px) {
377
+ #logox img {
378
+ position: relative;
379
+ object-position: center;
380
+ width: 30%;
381
+ height: 30%;
382
+ padding: 10px 10px 10px 10px;
383
+ }
384
+ .filenm {
385
+ border-radius: 6px;
386
+ gap: 0.3em;
387
+ font-size: 10px;
388
+ padding: 10px 12px;
389
+ margin: 0;
390
+ }
391
+ .filenm span {
392
+ text-overflow: ellipsis;
393
+ white-space: nowrap;
394
+ overflow: hidden;
395
+ }
396
+ .backbutton span {
397
+ font-size: 10px;
398
+ }
399
+ .backbutton {
400
+ padding: 12px 14px;
401
+ border-radius: 6px;
402
+ }
403
+ .labels {
404
+ padding: 0 0 5px 0;
405
+ margin: 0;
406
+ }
407
+ p {
408
+ padding: 8px;
409
+ font-size: 12px;
410
+ }
411
+ .uploadbutton {
412
+ padding: 8px 24px;
413
+ font-size: 14px;
414
+ font-weight: 300;
415
+ }
416
+ p.desc {
417
+ font-size: 6px;
418
+ line-height: 12px;
419
+ }
420
+ .valid {
421
+ padding-left: 5px;
422
+ font-size: 12px;
423
+ }
424
+ .labels p {
425
+ padding: 8px 0 8px 0;
426
+ }
427
+ #dataTable th,
428
+ #dataTable td {
429
+ font-size: 6px;
430
+ text-align: left;
431
+ padding: 1px;
432
+ }
433
+ .exportbutton {
434
+ margin-left: 17px;
435
+ border-radius: 5px;
436
+ padding: .8em 1em;
437
+ font-weight: 300;
438
+ font-size: 12px;
439
+ }
440
+ .avatargif img {
441
+ margin-top: 1.25em;
442
+ }
443
+ }
444
+
445
+ @media screen and (max-width: 576px) {
446
+ /* Styles for screens up to 576px wide */
447
+ .containerz {
448
+ flex-direction