haroon103 commited on
Commit
d3e6c34
·
verified ·
1 Parent(s): 4589e83

Delete index.html

Browse files
Files changed (1) hide show
  1. index.html +0 -1074
index.html DELETED
@@ -1,1074 +0,0 @@
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>Spam Visions | Next-Gen Email Forensics AI</title>
7
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
8
- <style>
9
- :root {
10
- --primary: #4338ca;
11
- --primary-dark: #3730a3;
12
- --secondary: #0f172a;
13
- --success: #10b981;
14
- --success-light: #ecfdf5;
15
- --danger: #ef4444;
16
- --danger-light: #fef2f2;
17
- --light: #f8fafc;
18
- --gray: #64748b;
19
- --border: #e2e8f0;
20
- --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
21
- --transition: all 0.3s ease;
22
- --gradient-start: #f8fafc;
23
- --gradient-end: #f1f5f9;
24
- }
25
-
26
- * {
27
- margin: 0;
28
- padding: 0;
29
- box-sizing: border-box;
30
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
31
- }
32
-
33
- body {
34
- background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
35
- color: var(--secondary);
36
- line-height: 1.6;
37
- min-height: 100vh;
38
- }
39
-
40
- .container {
41
- width: 95%;
42
- max-width: 1200px;
43
- margin: 0 auto;
44
- padding: 20px;
45
- }
46
-
47
- /* Header */
48
- header {
49
- background: white;
50
- box-shadow: 0 2px 10px rgba(0,0,0,0.05);
51
- position: sticky;
52
- top: 0;
53
- z-index: 100;
54
- }
55
-
56
- .header-content {
57
- display: flex;
58
- justify-content: space-between;
59
- align-items: center;
60
- padding: 1rem 2rem;
61
- }
62
-
63
- .logo {
64
- display: flex;
65
- align-items: center;
66
- gap: 10px;
67
- }
68
-
69
- .logo i {
70
- font-size: 1.5rem;
71
- color: var(--primary);
72
- }
73
-
74
- .logo h1 {
75
- font-size: 1.3rem;
76
- font-weight: 700;
77
- color: var(--secondary);
78
- }
79
-
80
- .nav-links {
81
- display: flex;
82
- gap: 2rem;
83
- }
84
-
85
- .nav-links a {
86
- text-decoration: none;
87
- color: var(--gray);
88
- font-weight: 500;
89
- transition: color 0.2s ease;
90
- }
91
-
92
- .nav-links a:hover {
93
- color: var(--primary);
94
- }
95
-
96
- /* Hero Section */
97
- .hero {
98
- padding: 5rem 2rem;
99
- text-align: center;
100
- background: linear-gradient(135deg, var(--primary), var(--primary-dark));
101
- color: white;
102
- margin-bottom: 3rem;
103
- }
104
-
105
- .hero-badge {
106
- background: rgba(255,255,255,0.2);
107
- padding: 8px 20px;
108
- border-radius: 20px;
109
- font-size: 0.9rem;
110
- display: inline-block;
111
- margin-bottom: 1.5rem;
112
- }
113
-
114
- .hero h1 {
115
- font-size: 2.5rem;
116
- margin-bottom: 1rem;
117
- line-height: 1.2;
118
- }
119
-
120
- .hero p {
121
- font-size: 1.1rem;
122
- max-width: 600px;
123
- margin: 0 auto 2rem;
124
- opacity: 0.9;
125
- }
126
-
127
- .hero-buttons {
128
- display: flex;
129
- justify-content: center;
130
- gap: 1rem;
131
- flex-wrap: wrap;
132
- }
133
-
134
- .btn {
135
- padding: 12px 25px;
136
- font-size: 1rem;
137
- font-weight: 600;
138
- border-radius: 8px;
139
- cursor: pointer;
140
- transition: var(--transition);
141
- display: flex;
142
- align-items: center;
143
- gap: 8px;
144
- text-decoration: none;
145
- }
146
-
147
- .btn-primary {
148
- background: white;
149
- color: var(--primary);
150
- border: none;
151
- }
152
-
153
- .btn-primary:hover {
154
- background: rgba(255,255,255,0.9);
155
- transform: translateY(-2px);
156
- }
157
-
158
- .btn-secondary {
159
- background: transparent;
160
- color: white;
161
- border: 2px solid rgba(255,255,255,0.3);
162
- }
163
-
164
- .btn-secondary:hover {
165
- background: rgba(255,255,255,0.1);
166
- transform: translateY(-2px);
167
- }
168
-
169
- /* Features Section */
170
- .features {
171
- padding: 3rem 2rem;
172
- margin-bottom: 3rem;
173
- }
174
-
175
- .section-title {
176
- font-size: 2rem;
177
- text-align: center;
178
- margin-bottom: 2rem;
179
- color: var(--primary-dark);
180
- }
181
-
182
- .features-grid {
183
- display: grid;
184
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
185
- gap: 2rem;
186
- }
187
-
188
- .feature-card {
189
- background: white;
190
- border-radius: 12px;
191
- padding: 2rem;
192
- box-shadow: var(--card-shadow);
193
- transition: var(--transition);
194
- }
195
-
196
- .feature-card:hover {
197
- transform: translateY(-5px);
198
- box-shadow: 0 8px 20px rgba(0,0,0,0.1);
199
- }
200
-
201
- .feature-icon {
202
- font-size: 2.5rem;
203
- color: var(--primary);
204
- margin-bottom: 1rem;
205
- }
206
-
207
- .feature-card h3 {
208
- font-size: 1.3rem;
209
- margin-bottom: 1rem;
210
- color: var(--secondary);
211
- }
212
-
213
- .feature-card p {
214
- color: var(--gray);
215
- }
216
-
217
- /* Analysis Section */
218
- .analysis-section {
219
- padding: 3rem 2rem;
220
- background: white;
221
- border-radius: 12px;
222
- box-shadow: var(--card-shadow);
223
- margin-bottom: 3rem;
224
- }
225
-
226
- .analysis-header {
227
- text-align: center;
228
- margin-bottom: 2rem;
229
- }
230
-
231
- .analysis-header h2 {
232
- font-size: 2rem;
233
- color: var(--primary-dark);
234
- margin-bottom: 1rem;
235
- }
236
-
237
- .analysis-header p {
238
- color: var(--gray);
239
- max-width: 600px;
240
- margin: 0 auto;
241
- }
242
-
243
- .upload-container {
244
- display: flex;
245
- flex-direction: column;
246
- gap: 2rem;
247
- max-width: 800px;
248
- margin: 0 auto;
249
- }
250
-
251
- .upload-option {
252
- background: white;
253
- border: 2px dashed var(--border);
254
- border-radius: 12px;
255
- padding: 2rem;
256
- text-align: center;
257
- cursor: pointer;
258
- transition: var(--transition);
259
- }
260
-
261
- .upload-option:hover {
262
- border-color: var(--primary);
263
- background: rgba(67, 56, 202, 0.05);
264
- }
265
-
266
- .upload-option.active {
267
- border-color: var(--primary);
268
- background: rgba(67, 56, 202, 0.1);
269
- box-shadow: 0 0 0 3px rgba(67, 56, 202, 0.2);
270
- }
271
-
272
- .upload-icon {
273
- font-size: 3.5rem;
274
- margin-bottom: 1rem;
275
- color: var(--primary);
276
- }
277
-
278
- .upload-option h3 {
279
- font-size: 1.4rem;
280
- margin-bottom: 1rem;
281
- color: var(--primary-dark);
282
- }
283
-
284
- .upload-desc {
285
- color: var(--gray);
286
- margin-bottom: 1.5rem;
287
- }
288
-
289
- .file-input {
290
- display: none;
291
- }
292
-
293
- .file-name {
294
- margin-top: 1rem;
295
- font-weight: 500;
296
- color: var(--primary);
297
- word-break: break-all;
298
- }
299
-
300
- .analyze-btn {
301
- background: var(--primary);
302
- color: white;
303
- border: none;
304
- padding: 12px 25px;
305
- font-size: 1rem;
306
- font-weight: 600;
307
- border-radius: 8px;
308
- cursor: pointer;
309
- transition: var(--transition);
310
- display: block;
311
- width: 100%;
312
- margin-top: 1rem;
313
- text-align: center;
314
- }
315
-
316
- .analyze-btn:hover {
317
- background: var(--primary-dark);
318
- transform: translateY(-2px);
319
- }
320
-
321
- .analyze-btn:disabled {
322
- opacity: 0.6;
323
- cursor: not-allowed;
324
- transform: none;
325
- }
326
-
327
- /* Results Section */
328
- .results-section {
329
- display: none;
330
- padding: 3rem 2rem;
331
- background: white;
332
- border-radius: 12px;
333
- box-shadow: var(--card-shadow);
334
- margin-bottom: 3rem;
335
- }
336
-
337
- .results-header {
338
- text-align: center;
339
- margin-bottom: 2rem;
340
- }
341
-
342
- .results-header h2 {
343
- font-size: 2rem;
344
- color: var(--primary-dark);
345
- margin-bottom: 1rem;
346
- }
347
-
348
- .results-header p {
349
- color: var(--gray);
350
- }
351
-
352
- .report-card {
353
- background: white;
354
- border-radius: 12px;
355
- padding: 2rem;
356
- box-shadow: var(--card-shadow);
357
- margin-bottom: 2rem;
358
- }
359
-
360
- .report-header {
361
- display: flex;
362
- justify-content: space-between;
363
- align-items: center;
364
- padding-bottom: 1rem;
365
- border-bottom: 2px solid var(--border);
366
- margin-bottom: 1.5rem;
367
- }
368
-
369
- .report-title {
370
- font-size: 1.5rem;
371
- color: var(--secondary);
372
- }
373
-
374
- .report-time {
375
- color: var(--gray);
376
- font-size: 0.9rem;
377
- }
378
-
379
- .result-summary {
380
- display: flex;
381
- justify-content: space-between;
382
- align-items: center;
383
- padding: 1.5rem;
384
- background: #f8fafc;
385
- border-radius: 10px;
386
- margin-bottom: 1.5rem;
387
- }
388
-
389
- .result-status {
390
- display: flex;
391
- align-items: center;
392
- gap: 1rem;
393
- }
394
-
395
- .status-badge {
396
- padding: 8px 16px;
397
- border-radius: 20px;
398
- font-weight: 600;
399
- font-size: 1rem;
400
- }
401
-
402
- .status-spam {
403
- background: var(--danger-light);
404
- color: var(--danger);
405
- }
406
-
407
- .status-not-spam {
408
- background: var(--success-light);
409
- color: var(--success);
410
- }
411
-
412
- .confidence-meter {
413
- display: flex;
414
- align-items: center;
415
- gap: 1rem;
416
- }
417
-
418
- .confidence-label {
419
- font-weight: 600;
420
- color: var(--secondary);
421
- }
422
-
423
- .confidence-bar {
424
- height: 8px;
425
- width: 100%;
426
- background: var(--border);
427
- border-radius: 4px;
428
- overflow: hidden;
429
- }
430
-
431
- .confidence-fill {
432
- height: 100%;
433
- background: var(--primary);
434
- border-radius: 4px;
435
- }
436
-
437
- .details-grid {
438
- display: grid;
439
- grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
440
- gap: 1.5rem;
441
- margin-top: 1.5rem;
442
- }
443
-
444
- .detail-item {
445
- background: #f8fafc;
446
- padding: 1.5rem;
447
- border-radius: 8px;
448
- }
449
-
450
- .detail-label {
451
- font-size: 0.9rem;
452
- color: var(--gray);
453
- margin-bottom: 0.5rem;
454
- }
455
-
456
- .detail-value {
457
- font-size: 1.2rem;
458
- font-weight: 600;
459
- color: var(--secondary);
460
- }
461
-
462
- /* Loading Indicator */
463
- .loading-overlay {
464
- display: none;
465
- position: fixed;
466
- top: 0;
467
- left: 0;
468
- width: 100%;
469
- height: 100%;
470
- background: rgba(255,255,255,0.9);
471
- z-index: 1000;
472
- display: flex;
473
- justify-content: center;
474
- align-items: center;
475
- flex-direction: column;
476
- }
477
-
478
- .loading-spinner {
479
- width: 50px;
480
- height: 50px;
481
- border: 5px solid rgba(67, 56, 202, 0.3);
482
- border-radius: 50%;
483
- border-top-color: var(--primary);
484
- animation: spin 1s ease-in-out infinite;
485
- margin-bottom: 1rem;
486
- }
487
-
488
- @keyframes spin {
489
- to { transform: rotate(360deg); }
490
- }
491
-
492
- .loading-text {
493
- font-size: 1.2rem;
494
- color: var(--secondary);
495
- text-align: center;
496
- }
497
-
498
- /* Footer */
499
- footer {
500
- background: var(--secondary);
501
- color: rgba(255,255,255,0.85);
502
- padding: 3rem 2rem;
503
- margin-top: 3rem;
504
- }
505
-
506
- .footer-content {
507
- display: flex;
508
- flex-wrap: wrap;
509
- justify-content: space-between;
510
- gap: 3rem;
511
- }
512
-
513
- .footer-column {
514
- flex: 1;
515
- min-width: 250px;
516
- }
517
-
518
- .footer-title {
519
- font-size: 1.3rem;
520
- margin-bottom: 1.5rem;
521
- color: white;
522
- display: flex;
523
- align-items: center;
524
- gap: 10px;
525
- }
526
-
527
- .footer-title i {
528
- color: var(--primary);
529
- }
530
-
531
- .footer-links {
532
- list-style: none;
533
- }
534
-
535
- .footer-links li {
536
- margin-bottom: 0.8rem;
537
- }
538
-
539
- .footer-links a {
540
- color: rgba(255,255,255,0.7);
541
- text-decoration: none;
542
- transition: color 0.2s ease;
543
- }
544
-
545
- .footer-links a:hover {
546
- color: white;
547
- }
548
-
549
- .footer-company {
550
- color: rgba(255,255,255,0.7);
551
- line-height: 1.6;
552
- margin-bottom: 1.5rem;
553
- }
554
-
555
- .footer-copyright {
556
- margin-top: 2rem;
557
- padding-top: 1.5rem;
558
- border-top: 1px solid rgba(255,255,255,0.1);
559
- text-align: center;
560
- font-size: 0.9rem;
561
- }
562
-
563
- /* Responsive Design */
564
- @media (max-width: 768px) {
565
- .header-content {
566
- padding: 1rem;
567
- flex-direction: column;
568
- gap: 1rem;
569
- }
570
-
571
- .nav-links {
572
- gap: 1rem;
573
- flex-wrap: wrap;
574
- justify-content: center;
575
- }
576
-
577
- .hero {
578
- padding: 3rem 1rem;
579
- }
580
-
581
- .hero h1 {
582
- font-size: 2rem;
583
- }
584
-
585
- .hero-buttons {
586
- flex-direction: column;
587
- align-items: center;
588
- }
589
-
590
- .features-grid {
591
- grid-template-columns: 1fr;
592
- }
593
-
594
- .upload-container {
595
- gap: 1rem;
596
- }
597
-
598
- .footer-content {
599
- flex-direction: column;
600
- }
601
-
602
- .footer-column {
603
- min-width: 100%;
604
- }
605
- }
606
-
607
- @media (max-width: 480px) {
608
- .section-title {
609
- font-size: 1.5rem;
610
- }
611
-
612
- .hero h1 {
613
- font-size: 1.5rem;
614
- }
615
-
616
- .feature-card h3 {
617
- font-size: 1.2rem;
618
- }
619
-
620
- .report-title {
621
- font-size: 1.3rem;
622
- }
623
-
624
- .detail-value {
625
- font-size: 1.1rem;
626
- }
627
- }
628
- </style>
629
- </head>
630
- <body>
631
- <!-- Header -->
632
- <header>
633
- <div class="container">
634
- <div class="header-content">
635
- <div class="logo">
636
- <i class="fas fa-eye"></i>
637
- <h1>Spam Visions</h1>
638
- </div>
639
- <nav class="nav-links">
640
- <a href="#home">Home</a>
641
- <a href="#features">Features</a>
642
- <a href="#analyze">Analyze</a>
643
- <a href="#contact">Contact</a>
644
- </nav>
645
- </div>
646
- </div>
647
- </header>
648
-
649
- <!-- Hero Section -->
650
- <section class="hero" id="home">
651
- <div class="container">
652
- <div class="hero-badge">
653
- <i class="fas fa-bolt"></i> POWERED BY DEBERTA-V3 TRANSFORMERS
654
- </div>
655
- <h1>Next-Gen Email Spam Detection AI</h1>
656
- <p>Advanced transformer technology for forensic email analysis. Detect spam with 98.7% accuracy using state-of-the-art NLP models.</p>
657
- <div class="hero-buttons">
658
- <a href="#analyze" class="btn btn-primary">
659
- <i class="fas fa-file-upload"></i> Start Analysis
660
- </a>
661
- <a href="#features" class="btn btn-secondary">
662
- <i class="fas fa-info-circle"></i> Learn More
663
- </a>
664
- </div>
665
- </div>
666
- </section>
667
-
668
- <!-- Features Section -->
669
- <section class="features" id="features">
670
- <div class="container">
671
- <h2 class="section-title">Advanced AI Capabilities</h2>
672
- <div class="features-grid">
673
- <div class="feature-card">
674
- <div class="feature-icon">
675
- <i class="fas fa-brain"></i>
676
- </div>
677
- <h3>Transformer Architecture</h3>
678
- <p>Powered by Microsoft's DeBERTa-v3-base model for superior contextual understanding of email content.</p>
679
- </div>
680
- <div class="feature-card">
681
- <div class="feature-icon">
682
- <i class="fas fa-shield-alt"></i>
683
- </div>
684
- <h3>Multi-Layer Forensic Analysis</h3>
685
- <p>Deep semantic analysis that detects subtle spam indicators beyond simple keyword matching.</p>
686
- </div>
687
- <div class="feature-card">
688
- <div class="feature-icon">
689
- <i class="fas fa-bolt"></i>
690
- </div>
691
- <h3>Real-Time Processing</h3>
692
- <p>Get instant results with sub-second processing times for documents up to 10MB in size.</p>
693
- </div>
694
- </div>
695
- </div>
696
- </section>
697
-
698
- <!-- Analysis Section -->
699
- <section class="analysis-section" id="analyze">
700
- <div class="container">
701
- <div class="analysis-header">
702
- <h2>Document Analysis</h2>
703
- <p>Upload your PDF or Word document for advanced spam detection using our AI-powered system.</p>
704
- </div>
705
-
706
- <div class="upload-container">
707
- <!-- PDF Upload -->
708
- <div class="upload-option" id="pdfOption">
709
- <div class="upload-icon">
710
- <i class="fas fa-file-pdf"></i>
711
- </div>
712
- <h3>PDF Document</h3>
713
- <p class="upload-desc">Upload a PDF file containing email content for analysis</p>
714
- <input type="file" id="pdfInput" class="file-input" accept=".pdf">
715
- <button class="upload-btn" onclick="document.getElementById('pdfInput').click()">
716
- <i class="fas fa-upload"></i> Select PDF
717
- </button>
718
- <div id="pdfFileName" class="file-name"></div>
719
- <button id="pdfAnalyzeBtn" class="analyze-btn" disabled>
720
- <i class="fas fa-search"></i> Analyze PDF
721
- </button>
722
- </div>
723
-
724
- <!-- Word Upload -->
725
- <div class="upload-option" id="wordOption">
726
- <div class="upload-icon">
727
- <i class="fas fa-file-word"></i>
728
- </div>
729
- <h3>Word Document</h3>
730
- <p class="upload-desc">Upload a DOC/DOCX file containing email content for analysis</p>
731
- <input type="file" id="wordInput" class="file-input" accept=".doc,.docx">
732
- <button class="upload-btn" onclick="document.getElementById('wordInput').click()">
733
- <i class="fas fa-upload"></i> Select Word
734
- </button>
735
- <div id="wordFileName" class="file-name"></div>
736
- <button id="wordAnalyzeBtn" class="analyze-btn" disabled>
737
- <i class="fas fa-search"></i> Analyze Word
738
- </button>
739
- </div>
740
- </div>
741
- </div>
742
- </section>
743
-
744
- <!-- Results Section -->
745
- <section class="results-section" id="resultsSection">
746
- <div class="container">
747
- <div class="results-header">
748
- <h2>Analysis Report</h2>
749
- <p>Your document has been analyzed using our advanced AI system.</p>
750
- </div>
751
-
752
- <div class="report-card">
753
- <div class="report-header">
754
- <div class="report-title">Forensic Analysis Report</div>
755
- <div class="report-time" id="reportTime">-</div>
756
- </div>
757
-
758
- <div class="result-summary">
759
- <div class="result-status">
760
- <span id="resultBadge" class="status-badge status-not-spam">NOT SPAM</span>
761
- </div>
762
- <div class="confidence-meter">
763
- <div class="confidence-label">Confidence:</div>
764
- <div class="confidence-bar">
765
- <div id="confidenceFill" class="confidence-fill" style="width: 85%"></div>
766
- </div>
767
- <div id="confidenceValue" class="confidence-label">85%</div>
768
- </div>
769
- </div>
770
-
771
- <div class="details-grid">
772
- <div class="detail-item">
773
- <div class="detail-label">File Name</div>
774
- <div id="fileName" class="detail-value">-</div>
775
- </div>
776
- <div class="detail-item">
777
- <div class="detail-label">File Size</div>
778
- <div id="fileSize" class="detail-value">-</div>
779
- </div>
780
- <div class="detail-item">
781
- <div class="detail-label">Analysis Type</div>
782
- <div id="analysisType" class="detail-value">PDF</div>
783
- </div>
784
- <div class="detail-item">
785
- <div class="detail-label">Processing Time</div>
786
- <div id="processingTime" class="detail-value">-</div>
787
- </div>
788
- <div class="detail-item">
789
- <div class="detail-label">Model Version</div>
790
- <div id="modelVersion" class="detail-value">v1.0.0</div>
791
- </div>
792
- <div class="detail-item">
793
- <div class="detail-label">Threat Score</div>
794
- <div id="threatScore" class="detail-value">0.15</div>
795
- </div>
796
- </div>
797
- </div>
798
- </div>
799
- </section>
800
-
801
- <!-- Loading Overlay -->
802
- <div class="loading-overlay" id="loadingOverlay">
803
- <div class="loading-spinner"></div>
804
- <div class="loading-text">Analyzing your document with Spam Visions AI...</div>
805
- </div>
806
-
807
- <!-- Footer -->
808
- <footer>
809
- <div class="container">
810
- <div class="footer-content">
811
- <div class="footer-column">
812
- <div class="footer-title">
813
- <i class="fas fa-eye"></i> Spam Visions
814
- </div>
815
- <div class="footer-company">
816
- Advanced email spam detection powered by next-generation transformer technology.
817
- Protecting digital communication worldwide with best-in-class accuracy.
818
- </div>
819
- </div>
820
-
821
- <div class="footer-column">
822
- <div class="footer-title">
823
- <i class="fas fa-cube"></i> Product
824
- </div>
825
- <ul class="footer-links">
826
- <li><a href="#analyze">Detection Service</a></li>
827
- <li><a href="#features">Features</a></li>
828
- <li><a href="https://haroon103-sppamemail.hf.space/docs">API Documentation</a></li>
829
- <li><a href="#">Enterprise Solutions</a></li>
830
- </ul>
831
- </div>
832
-
833
- <div class="footer-column">
834
- <div class="footer-title">
835
- <i class="fas fa-building"></i> Company
836
- </div>
837
- <ul class="footer-links">
838
- <li><a href="#contact">Contact</a></li>
839
- <li><a href="#">About Us</a></li>
840
- <li><a href="#">Careers</a></li>
841
- <li><a href="#">Privacy Policy</a></li>
842
- </ul>
843
- </div>
844
- </div>
845
-
846
- <div class="footer-copyright">
847
- © 2025 Spam Visions. All rights reserved.
848
- </div>
849
- </div>
850
- </footer>
851
-
852
- <script>
853
- // API Configuration
854
- const API_BASE_URL = 'https://haroon103-sppamemail.hf.space';
855
-
856
- // DOM Elements
857
- const pdfInput = document.getElementById('pdfInput');
858
- const wordInput = document.getElementById('wordInput');
859
- const pdfFileName = document.getElementById('pdfFileName');
860
- const wordFileName = document.getElementById('wordFileName');
861
- const pdfOption = document.getElementById('pdfOption');
862
- const wordOption = document.getElementById('wordOption');
863
- const pdfAnalyzeBtn = document.getElementById('pdfAnalyzeBtn');
864
- const wordAnalyzeBtn = document.getElementById('wordAnalyzeBtn');
865
- const loadingOverlay = document.getElementById('loadingOverlay');
866
- const resultsSection = document.getElementById('resultsSection');
867
-
868
- // Results elements
869
- const fileNameEl = document.getElementById('fileName');
870
- const fileSizeEl = document.getElementById('fileSize');
871
- const analysisTypeEl = document.getElementById('analysisType');
872
- const processingTimeEl = document.getElementById('processingTime');
873
- const modelVersionEl = document.getElementById('modelVersion');
874
- const threatScoreEl = document.getElementById('threatScore');
875
- const resultBadgeEl = document.getElementById('resultBadge');
876
- const confidenceFillEl = document.getElementById('confidenceFill');
877
- const confidenceValueEl = document.getElementById('confidenceValue');
878
- const reportTimeEl = document.getElementById('reportTime');
879
-
880
- // File selection handlers
881
- pdfInput.addEventListener('change', function(e) {
882
- handleFileSelection(e, 'pdf');
883
- });
884
-
885
- wordInput.addEventListener('change', function(e) {
886
- handleFileSelection(e, 'word');
887
- });
888
-
889
- function handleFileSelection(e, type) {
890
- if (e.target.files.length > 0) {
891
- const file = e.target.files[0];
892
-
893
- // Validate file size
894
- if (file.size > 10 * 1024 * 1024) {
895
- alert('File size exceeds 10MB limit. Please select a smaller file.');
896
- e.target.value = '';
897
- return;
898
- }
899
-
900
- if (type === 'pdf') {
901
- pdfFileName.textContent = file.name;
902
- pdfOption.classList.add('active');
903
- wordOption.classList.remove('active');
904
- wordFileName.textContent = '';
905
- pdfAnalyzeBtn.disabled = false;
906
- wordAnalyzeBtn.disabled = true;
907
- } else {
908
- wordFileName.textContent = file.name;
909
- wordOption.classList.add('active');
910
- pdfOption.classList.remove('active');
911
- pdfFileName.textContent = '';
912
- wordAnalyzeBtn.disabled = false;
913
- pdfAnalyzeBtn.disabled = true;
914
- }
915
- }
916
- }
917
-
918
- // PDF analysis
919
- pdfAnalyzeBtn.addEventListener('click', function() {
920
- if (pdfInput.files.length === 0) {
921
- alert('Please select a PDF file first');
922
- return;
923
- }
924
- analyzeDocument(pdfInput.files[0], 'pdf');
925
- });
926
-
927
- // Word analysis
928
- wordAnalyzeBtn.addEventListener('click', function() {
929
- if (wordInput.files.length === 0) {
930
- alert('Please select a Word document first');
931
- return;
932
- }
933
- analyzeDocument(wordInput.files[0], 'word');
934
- });
935
-
936
- // Document Analysis Function
937
- async function analyzeDocument(file, type) {
938
- showLoading();
939
-
940
- try {
941
- const formData = new FormData();
942
- formData.append('file', file);
943
-
944
- const startTime = Date.now();
945
- const response = await fetch(`${API_BASE_URL}/predict/pdf`, {
946
- method: 'POST',
947
- body: formData
948
- });
949
-
950
- const endTime = Date.now();
951
- const processingTime = (endTime - startTime) / 1000;
952
-
953
- if (!response.ok) {
954
- throw new Error(`HTTP ${response.status}: ${response.statusText}`);
955
- }
956
-
957
- const data = await response.json();
958
-
959
- // ✅ CORRECTED: Parse response properly
960
- displayResults(data, type, file, processingTime);
961
-
962
- } catch (error) {
963
- hideLoading();
964
- alert(`Analysis failed: ${error.message}\n\nPlease check your file and try again.`);
965
- console.error('Document analysis error:', error);
966
- }
967
- }
968
-
969
- // ✅ FULLY CORRECTED displayResults function
970
- function displayResults(data, type, file, processingTime) {
971
- // Set basic information
972
- fileNameEl.textContent = file.name;
973
- fileSizeEl.textContent = formatFileSize(file.size);
974
- analysisTypeEl.textContent = type.toUpperCase();
975
- processingTimeEl.textContent = `${processingTime.toFixed(2)} seconds`;
976
- modelVersionEl.textContent = 'v1.0.0';
977
-
978
- // ✅ CORRECT WAY TO EXTRACT FROM YOUR API
979
- const predictionData = data.prediction;
980
- const isSpam = predictionData.prediction === 'SPAM';
981
- const confidence = predictionData.confidence; // Already in 0-100 range
982
-
983
- // Set result classification
984
- if (isSpam) {
985
- resultBadgeEl.textContent = 'SPAM';
986
- resultBadgeEl.className = 'status-badge status-spam';
987
- } else {
988
- resultBadgeEl.textContent = 'NOT SPAM';
989
- resultBadgeEl.className = 'status-badge status-not-spam';
990
- }
991
-
992
- // Update confidence display
993
- confidenceFillEl.style.width = `${confidence}%`;
994
- confidenceValueEl.textContent = `${confidence.toFixed(1)}%`;
995
-
996
- // Calculate threat score (0.0000 to 1.0000)
997
- const threatScore = isSpam ? confidence / 100 : (100 - confidence) / 100;
998
- threatScoreEl.textContent = threatScore.toFixed(4);
999
-
1000
- // Set timestamp
1001
- const now = new Date();
1002
- reportTimeEl.textContent = now.toLocaleString();
1003
-
1004
- // Show results
1005
- hideLoading();
1006
- resultsSection.style.display = 'block';
1007
- resultsSection.scrollIntoView({ behavior: 'smooth' });
1008
- }
1009
-
1010
- // Show loading indicator
1011
- function showLoading() {
1012
- loadingOverlay.style.display = 'flex';
1013
- }
1014
-
1015
- // Hide loading indicator
1016
- function hideLoading() {
1017
- loadingOverlay.style.display = 'none';
1018
- }
1019
-
1020
- // Format file size
1021
- function formatFileSize(bytes) {
1022
- if (bytes < 1024) return bytes + ' bytes';
1023
- if (bytes < 1048576) return (bytes / 1024).toFixed(1) + ' KB';
1024
- return (bytes / 1048576).toFixed(1) + ' MB';
1025
- }
1026
-
1027
- // Add drag and drop functionality
1028
- const uploadOptions = document.querySelectorAll('.upload-option');
1029
- uploadOptions.forEach(option => {
1030
- option.addEventListener('dragover', function(e) {
1031
- e.preventDefault();
1032
- this.classList.add('active');
1033
- });
1034
-
1035
- option.addEventListener('dragleave', function() {
1036
- if (!this.querySelector('.file-input').files.length) {
1037
- this.classList.remove('active');
1038
- }
1039
- });
1040
-
1041
- option.addEventListener('drop', function(e) {
1042
- e.preventDefault();
1043
- this.classList.remove('active');
1044
- const files = e.dataTransfer.files;
1045
- if (files.length > 0) {
1046
- const file = files[0];
1047
- const input = this.querySelector('.file-input');
1048
-
1049
- // Validate file type
1050
- if (this.id === 'pdfOption' && file.type !== 'application/pdf') {
1051
- alert('Please select a PDF file');
1052
- return;
1053
- }
1054
- if (this.id === 'wordOption' &&
1055
- file.type !== 'application/msword' &&
1056
- file.type !== 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
1057
- alert('Please select a Word document (.doc or .docx)');
1058
- return;
1059
- }
1060
-
1061
- // Set file to input
1062
- const dataTransfer = new DataTransfer();
1063
- dataTransfer.items.add(file);
1064
- input.files = dataTransfer.files;
1065
-
1066
- // Trigger change event
1067
- const event = new Event('change', { bubbles: true });
1068
- input.dispatchEvent(event);
1069
- }
1070
- });
1071
- });
1072
- </script>
1073
- </body>
1074
- </html>