xuandin commited on
Commit
7264a9c
·
verified ·
1 Parent(s): 5701a4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -377
app.py CHANGED
@@ -180,8 +180,8 @@ with st.container():
180
  "NEI": "⚠️"
181
  }
182
 
183
- # Tabs: Verify, History, About
184
- tabs = st.tabs(["Verify", "History", "About"])
185
 
186
  # --- Tab Verify ---
187
  with tabs[0]:
@@ -212,9 +212,9 @@ with st.container():
212
  evidence_time = time.time() - evidence_start_time
213
 
214
  # Classify the claim
215
- verdict_start_time = time.time()
216
  verdict = "NEI"
217
  details = ""
 
218
  prob2class, pred_bc = 0, "Not used"
219
  prob3class, pred_tc = classify_claim(
220
  claim, evidence, model_tc, tokenizer_tc,
@@ -226,32 +226,26 @@ with st.container():
226
  "cuda" if torch.cuda.is_available() else "cpu"
227
  )
228
  verdict = "SUPPORTED" if pred_bc == 0 else "REFUTED" if prob2class > prob3class else ["NEI", "SUPPORTED", "REFUTED"][pred_tc]
229
-
230
  if show_details:
231
  details = f"""
232
- <p><strong>3-Class Probability:</strong> {prob3class.item():.2f}</p>
233
- <p><strong>3-Class Predicted Label:</strong> {['NEI', 'SUPPORTED', 'REFUTED'][pred_tc]}</p>
234
- <p><strong>2-Class Probability:</strong> {prob2class.item():.2f}</p>
235
- <p><strong>2-Class Predicted Label:</strong> {['SUPPORTED', 'REFUTED'][pred_bc]}</p>
236
  """
237
- verdict_time = time.time() - verdict_start_time
238
-
239
- # Store verification history and the latest result
240
- st.session_state.history.append({
241
- "claim": claim,
242
- "evidence": evidence,
243
- "verdict": verdict,
244
- "evidence_time": evidence_time,
245
- "verdict_time": verdict_time,
246
- "details": details
247
- })
248
  st.session_state.latest_result = {
249
  "claim": claim,
250
  "evidence": evidence,
251
  "verdict": verdict,
252
  "evidence_time": evidence_time,
253
  "verdict_time": verdict_time,
254
- "details": details
 
 
 
 
255
  }
256
 
257
  if torch.cuda.is_available():
@@ -266,6 +260,10 @@ with st.container():
266
  <p class='verdict'><span class='verdict-icon'>{verdict_icons.get(res['verdict'], '')}</span>{res['verdict']}</p>
267
  <p><strong>Evidence Inference Time:</strong> {res['evidence_time']:.2f} seconds</p>
268
  <p><strong>Verdict Inference Time:</strong> {res['verdict_time']:.2f} seconds</p>
 
 
 
 
269
  {res['details']}
270
  </div>
271
  """, unsafe_allow_html=True)
@@ -291,360 +289,3 @@ with st.container():
291
  st.markdown(f"**{idx}. Claim:** {record['claim']} \n**Result:** {verdict_icons.get(record['verdict'], '')} {record['verdict']}")
292
  else:
293
  st.write("No verification history yet.")
294
-
295
- # --- Tab About ---
296
- with tabs[2]:
297
- st.subheader("About")
298
- about_content = '''
299
- <p align="center">
300
- <img alt="SemViQA Logo" src="https://raw.githubusercontent.com/DAVID-NGUYEN-S16/SemViQA/main/image/logo.png" height="200" />
301
- <br>
302
- </p>
303
- </p>
304
-
305
- <p align="center">
306
- <a href="https://arxiv.org/abs/2503.00955">
307
- <img src="https://img.shields.io/badge/arXiv-2411.00918-red?style=flat&label=arXiv">
308
- </a>
309
- <a href="https://huggingface.co/SemViQA">
310
- <img src="https://img.shields.io/badge/Hugging%20Face-Model-yellow?style=flat">
311
- </a>
312
- <a href="https://pypi.org/project/SemViQA">
313
- <img src="https://img.shields.io/pypi/v/SemViQA?color=blue&label=PyPI">
314
- </a>
315
- <a href="https://github.com/DAVID-NGUYEN-S16/SemViQA">
316
- <img src="https://img.shields.io/github/stars/DAVID-NGUYEN-S16/SemViQA?style=social">
317
- </a>
318
- </p>
319
-
320
-
321
- <p align="center">
322
- <a href="#-about">📌 About</a> •
323
- <a href="#-checkpoints">🔍 Checkpoints</a> •
324
- <a href="#-quick-start">🚀 Quick Start</a> •
325
- <a href="#-training">🏋️‍♂️ Training</a> •
326
- <a href="#-evaluation">📊 Evaluation</a> •
327
- <a href="#-citation">📖 Citation</a>
328
- </p>
329
-
330
- ---
331
-
332
- ## 📌 **About**
333
-
334
- Misinformation is a growing problem, exacerbated by the increasing use of **Large Language Models (LLMs)** like GPT and Gemini. This issue is even more critical for **low-resource languages like Vietnamese**, where existing fact-checking methods struggle with **semantic ambiguity, homonyms, and complex linguistic structures**.
335
-
336
- To address these challenges, we introduce **SemViQA**, a novel **Vietnamese fact-checking framework** integrating:
337
-
338
- - **Semantic-based Evidence Retrieval (SER)**: Combines **TF-IDF** with a **Question Answering Token Classifier (QATC)** to enhance retrieval precision while reducing inference time.
339
- - **Two-step Verdict Classification (TVC)**: Uses hierarchical classification optimized with **Cross-Entropy and Focal Loss**, improving claim verification across three categories:
340
- - **Supported** ✅
341
- - **Refuted** ❌
342
- - **Not Enough Information (NEI)** 🤷‍♂️
343
-
344
- ### **🏆 Achievements**
345
- - **1st place** in the **UIT Data Science Challenge** 🏅
346
- - **State-of-the-art** performance on:
347
- - **ISE-DSC01** → **78.97% strict accuracy**
348
- - **ViWikiFC** → **80.82% strict accuracy**
349
- - **SemViQA Faster**: **7x speed improvement** over the standard model 🚀
350
-
351
- These results establish **SemViQA** as a **benchmark for Vietnamese fact verification**, advancing efforts to combat misinformation and ensure **information integrity**.
352
-
353
- ---
354
- ## 🔍 Checkpoints
355
- We are making our **SemViQA** experiment checkpoints publicly available to support the **Vietnamese fact-checking research community**. By sharing these models, we aim to:
356
-
357
- - **Facilitate reproducibility**: Allow researchers and developers to validate and build upon our results.
358
- - **Save computational resources**: Enable fine-tuning or transfer learning on top of **pre-trained and fine-tuned models** instead of training from scratch.
359
- - **Encourage further improvements**: Provide a strong baseline for future advancements in **Vietnamese misinformation detection**.
360
-
361
-
362
- <table>
363
- <tr>
364
- <th>Method</th>
365
- <th>Model</th>
366
- <th>ViWikiFC</th>
367
- <th>ISE-DSC01</th>
368
- </tr>
369
- <tr>
370
- <td rowspan="3"><strong>TC</strong></td>
371
- <td>InfoXLM<sub>large</sub></td>
372
- <td><a href="https://huggingface.co/SemViQA/tc-infoxlm-viwikifc">Link</a></td>
373
- <td><a href="https://huggingface.co/SemViQA/tc-infoxlm-isedsc01">Link</a></td>
374
- </tr>
375
- <tr>
376
- <td>XLM-R<sub>large</sub></td>
377
- <td><a href="https://huggingface.co/SemViQA/tc-xlmr-viwikifc">Link</a></td>
378
- <td><a href="https://huggingface.co/SemViQA/tc-xlmr-isedsc01">Link</a></td>
379
- </tr>
380
- <tr>
381
- <td>Ernie-M<sub>large</sub></td>
382
- <td><a href="https://huggingface.co/SemViQA/tc-erniem-viwikifc">Link</a></td>
383
- <td><a href="https://huggingface.co/SemViQA/tc-erniem-isedsc01">Link</a></td>
384
- </tr>
385
- <tr>
386
- <td rowspan="3"><strong>BC</strong></td>
387
- <td>InfoXLM<sub>large</sub></td>
388
- <td><a href="https://huggingface.co/SemViQA/bc-infoxlm-viwikifc">Link</a></td>
389
- <td><a href="https://huggingface.co/SemViQA/bc-infoxlm-isedsc01">Link</a></td>
390
- </tr>
391
- <tr>
392
- <td>XLM-R<sub>large</sub></td>
393
- <td><a href="https://huggingface.co/SemViQA/bc-xlmr-viwikifc">Link</a></td>
394
- <td><a href="https://huggingface.co/SemViQA/bc-xlmr-isedsc01">Link</a></td>
395
- </tr>
396
- <tr>
397
- <td>Ernie-M<sub>large</sub></td>
398
- <td><a href="https://huggingface.co/SemViQA/bc-erniem-viwikifc">Link</a></td>
399
- <td><a href="https://huggingface.co/SemViQA/bc-erniem-isedsc01">Link</a></td>
400
- </tr>
401
- <tr>
402
- <td rowspan="2"><strong>QATC</strong></td>
403
- <td>InfoXLM<sub>large</sub></td>
404
- <td><a href="https://huggingface.co/SemViQA/qatc-infoxlm-viwikifc">Link</a></td>
405
- <td><a href="https://huggingface.co/SemViQA/qatc-infoxlm-isedsc01">Link</a></td>
406
- </tr>
407
- <tr>
408
- <td>ViMRC<sub>large</sub></td>
409
- <td><a href="https://huggingface.co/SemViQA/qatc-vimrc-viwikifc">Link</a></td>
410
- <td><a href="https://huggingface.co/SemViQA/qatc-vimrc-isedsc01">Link</a></td>
411
- </tr>
412
- <tr>
413
- <td rowspan="2"><strong>QA origin</strong></td>
414
- <td>InfoXLM<sub>large</sub></td>
415
- <td><a href="https://huggingface.co/SemViQA/infoxlm-large-viwikifc">Link</a></td>
416
- <td><a href="https://huggingface.co/SemViQA/infoxlm-large-isedsc01">Link</a></td>
417
- </tr>
418
- <tr>
419
- <td>ViMRC<sub>large</sub></td>
420
- <td><a href="https://huggingface.co/SemViQA/vi-mrc-large-viwikifc">Link</a></td>
421
- <td><a href="https://huggingface.co/SemViQA/vi-mrc-large-isedsc01">Link</a></td>
422
- </tr>
423
- </table>
424
-
425
-
426
-
427
- ---
428
-
429
- ## 🚀 **Quick Start**
430
-
431
- ### 📥 **Installation**
432
-
433
- #### **1️⃣ Clone this repository**
434
- ```bash
435
- git clone https://github.com/DAVID-NGUYEN-S16/SemViQA.git
436
- cd SemViQA
437
- ```
438
-
439
- #### **2️⃣ Set up Python environment**
440
- We recommend using **Python 3.11** in a virtual environment (`venv`) or **Anaconda**.
441
-
442
- **Using `venv`:**
443
- ```bash
444
- python -m venv semviqa_env
445
- source semviqa_env/bin/activate # On MacOS/Linux
446
- semviqa_env\Scripts\activate # On Windows
447
- ```
448
-
449
- **Using `Anaconda`:**
450
- ```bash
451
- conda create -n semviqa_env python=3.11 -y
452
- conda activate semviqa_env
453
- ```
454
-
455
- #### **3️⃣ Install dependencies**
456
- ```bash
457
- pip install --upgrade pip
458
- pip install transformers==4.42.3
459
- pip install torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu118
460
- pip install -r requirements.txt
461
- ```
462
- ---
463
-
464
- ## 🏋️‍♂️ **Training**
465
-
466
- Train different components of **SemViQA** using the provided scripts:
467
-
468
- ### **1️⃣ Three-Class Classification Training**
469
- Train a three-class claim classification model using the following command:
470
- ```bash
471
- bash scripts/tc.sh
472
- ```
473
- If you want to fine-tune the model using pre-trained weights, you can initialize it as follows:
474
- ```python
475
- # Install semviqa
476
- !pip install semviqa
477
-
478
- # Initalize a pipeline
479
- from transformers import AutoTokenizer
480
- from semviqa.tvc.model import ClaimModelForClassification
481
-
482
- tokenizer = AutoTokenizer.from_pretrained("SemViQA/tc-infoxlm-viwikifc")
483
- model = ClaimModelForClassification.from_pretrained("SemViQA/tc-infoxlm-viwikifc", num_labels=3)
484
- ```
485
-
486
- ### **2️⃣ Binary Classification Training**
487
- Train a binary classification model using the command below:
488
- ```bash
489
- bash scripts/bc.sh
490
- ```
491
- To fine-tune the model with existing weights, use the following setup:
492
- ```python
493
- # Install semviqa
494
- !pip install semviqa
495
-
496
- # Initalize a pipeline
497
- from transformers import AutoTokenizer
498
- from semviqa.tvc.model import ClaimModelForClassification
499
-
500
- tokenizer = AutoTokenizer.from_pretrained("SemViQA/bc-infoxlm-viwikifc")
501
- model = ClaimModelForClassification.from_pretrained("SemViQA/bc-infoxlm-viwikifc", num_labels=2)
502
- ```
503
-
504
- ### **3️⃣ QATC Model Training**
505
- Train the Question Answering Token Classifier (QATC) model using the following command:
506
- ```bash
507
- bash scripts/qatc.sh
508
- ```
509
-
510
- To continue training from pre-trained weights, use this setup:
511
- ```python
512
- # Install semviqa
513
- !pip install semviqa
514
-
515
- # Initalize a pipeline
516
- from transformers import AutoTokenizer
517
- from semviqa.ser.qatc_model import QATCForQuestionAnswering
518
-
519
- tokenizer = AutoTokenizer.from_pretrained("SemViQA/qatc-infoxlm-viwikifc")
520
- model = QATCForQuestionAnswering.from_pretrained("SemViQA/qatc-infoxlm-viwikifc")
521
- ```
522
-
523
- ---
524
-
525
- ## 📊 **Evaluation**
526
-
527
- ### **1️⃣ Semantic-based Evidence Retrieval**
528
- This module extracts the most relevant evidence from a given context based on a claim. It leverages TF-IDF combined with the QATC model to ensure accurate retrieval.
529
- ```python
530
- # Install semviqa package
531
- !pip install semviqa
532
-
533
- # Import the ser module
534
- import torch
535
- from transformers import AutoTokenizer
536
- from semviqa.ser.qatc_model import QATCForQuestionAnswering
537
- from semviqa.ser.ser_eval import extract_evidence_tfidf_qatc
538
-
539
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
540
-
541
- tokenizer = AutoTokenizer.from_pretrained("SemViQA/qatc-infoxlm-viwikifc")
542
- model = QATCForQuestionAnswering.from_pretrained("SemViQA/qatc-infoxlm-viwikifc")
543
-
544
- claim = "Chiến tranh với Campuchia đã kết thúc trước khi Việt Nam thống nhất."
545
- context = "Sau khi thống nhất, Việt Nam tiếp tục gặp khó khăn do sự sụp đổ và tan rã của đồng minh Liên Xô cùng Khối phía Đông, các lệnh cấm vận của Hoa Kỳ, chiến tranh với Campuchia, biên giới giáp Trung Quốc và hậu quả của chính sách bao cấp sau nhiều năm áp dụng. Năm 1986, Đảng Cộng sản ban hành cải cách đổi mới, tạo điều kiện hình thành kinh tế thị trường và hội nhập sâu rộng. Cải cách đổi mới kết hợp cùng quy mô dân số lớn đưa Việt Nam trở thành một trong những nước đang phát triển có tốc độ tăng trưởng thuộc nhóm nhanh nhất thế giới, được coi là Hổ mới châu Á dù cho vẫn gặp phải những thách thức như tham nhũng, tội phạm gia tăng, ô nhiễm môi trường và phúc lợi xã hội chưa đầy đủ. Ngoài ra, giới bất đồng chính kiến, chính phủ một số nước phương Tây và các tổ chức theo dõi nhân quyền có quan điểm chỉ trích hồ sơ nhân quyền của Việt Nam liên quan đến các vấn đề tôn giáo, kiểm duyệt truyền thông, hạn chế hoạt động ủng hộ nhân quyền cùng các quyền tự do dân sự."
546
-
547
- evidence = extract_evidence_tfidf_qatc(
548
- claim, context, model, tokenizer, device, confidence_threshold=0.5, length_ratio_threshold=0.6
549
- )
550
-
551
- print(evidence)
552
- # evidence: sau khi thống nhất việt nam tiếp tục gặp khó khăn do sự sụp đổ và tan rã của đồng minh liên xô cùng khối phía đông các lệnh cấm vận của hoa kỳ chiến tranh với campuchia biên giới giáp trung quốc và hậu quả của chính sách bao cấp sau nhiều năm áp dụng
553
- ```
554
-
555
-
556
- ### **2️⃣ Two-step Verdict Classification**
557
- This module performs claim classification using a **two-step approach**:
558
- 1. **Three-class classification**: Determines if a claim is **Supported, Refuted, or Not Enough Information (NEI)**.
559
- 2. **Binary classification** (if necessary): Further verifies if the claim is **Supported** or **Refuted**.
560
- ```python
561
- # Install semviqa package
562
- !pip install semviqa
563
-
564
- # Import the tvc module
565
- import torch
566
- from semviqa.tvc.tvc_eval import classify_claim
567
- from semviqa.tvc.model import ClaimModelForClassification
568
-
569
- device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
570
-
571
- tokenizer = AutoTokenizer.from_pretrained("SemViQA/tc-infoxlm-viwikifc")
572
- model_tc = ClaimModelForClassification.from_pretrained("SemViQA/tc-infoxlm-viwikifc", num_labels=3).to(device)
573
- model_bc = ClaimModelForClassification.from_pretrained("SemViQA/bc-infoxlm-viwikifc", num_labels=2).to(device)
574
-
575
- claim = "Chiến tranh với Campuchia đã kết thúc trước khi Việt Nam thống nhất."
576
- evidence = "Sau khi thống nhất, Việt Nam tiếp tục gặp khó khăn do sự sụp đổ và tan rã của đồng minh Liên Xô cùng Khối phía Đông, các lệnh cấm vận của Hoa Kỳ, chiến tranh với Campuchia, biên giới giáp Trung Quốc và hậu quả của chính sách bao cấp sau nhiều năm áp dụng."
577
-
578
- verdict = "NEI"
579
- prob_tc, pred_tc = classify_claim(claim, evidence, model_tc, tokenizer, device)
580
-
581
- if pred_tc != 0:
582
- prob_bc, pred_bc = classify_claim(claim, evidence, model_bc, tokenizer, device)
583
- verdict = "SUPPORTED" if pred_bc == 0 else "REFUTED" if prob_bc > prob_tc else ["NEI", "SUPPORTED", "REFUTED"][pred_tc]
584
-
585
- print(verdict)
586
- # Output: REFUTED
587
- ```
588
-
589
- ### **3️⃣ Full Pipeline Evaluation**
590
- Use the trained models to **predict test data**:
591
- ```bash
592
- bash scripts/pipeline.sh
593
- ```
594
-
595
- Alternatively, you can use **SemViQA** programmatically:
596
-
597
- ```python
598
- # Install semviqa package
599
- !pip install semviqa
600
-
601
- # Import the pipeline
602
- from semviqa.pipeline import SemViQAPipeline
603
- claim = "Chiến tranh với Campuchia đã kết thúc trước khi Việt Nam thống nhất."
604
- context = "Sau khi thống nhất, Việt Nam tiếp tục gặp khó khăn do sự sụp đổ và tan rã của đồng minh Liên Xô cùng Khối phía Đông, các lệnh cấm vận của Hoa Kỳ, chiến tranh với Campuchia, biên giới giáp Trung Quốc và hậu quả của chính sách bao cấp sau nhiều năm áp dụng. Năm 1986, Đảng Cộng sản ban hành cải cách đổi mới, tạo điều kiện hình thành kinh tế thị trường và hội nhập sâu rộng. Cải cách đổi mới kết hợp cùng quy mô dân số lớn đưa Việt Nam trở thành một trong những nước đang phát triển có tốc độ tăng trưởng thuộc nhóm nhanh nhất thế giới, được coi là Hổ mới châu Á dù cho vẫn gặp phải những thách thức như tham nhũng, tội phạm gia tăng, ô nhiễm môi trường và phúc lợi xã hội chưa đầy đủ. Ngoài ra, giới bất đồng chính kiến, chính phủ một số nước phương Tây và các tổ chức theo dõi nhân quyền có quan điểm chỉ trích hồ sơ nhân quyền của Việt Nam liên quan đến các vấn đề tôn giáo, kiểm duyệt truyền thông, hạn chế hoạt động ủng hộ nhân quyền cùng các quyền tự do dân sự."
605
-
606
- semviqa = SemViQAPipeline(
607
- model_evidence_QA="SemViQA/qatc-infoxlm-viwikifc",
608
- model_bc="SemViQA/bc-infoxlm-viwikifc",
609
- model_tc="SemViQA/tc-infoxlm-viwikifc",
610
- thres_evidence=0.5,
611
- length_ratio_threshold=0.5,
612
- is_qatc_faster=False
613
- )
614
-
615
- result = semviqa.predict(claim, context)
616
- print(result)
617
- # Output: {'verdict': 'REFUTED', 'evidence': 'sau khi thống nhất việt nam tiếp tục gặp khó khăn do sự sụp đổ và tan rã của đồng minh liên xô cùng khối phía đông các lệnh cấm vận của hoa kỳ chiến tranh với campuchia biên giới giáp trung quốc và hậu quả của chính sách bao cấp sau nhiều năm áp dụng'}
618
-
619
- # Extract only evidence
620
- evidence_only = semviqa.predict(claim, context, return_evidence_only=True)
621
- print(evidence_only)
622
- # Output: {'evidence': 'sau khi thống nhất việt nam tiếp tục gặp khó khăn do sự sụp đổ và tan rã của đồng minh liên xô cùng khối phía đông các lệnh cấm vận của hoa kỳ chiến tranh với campuchia biên giới giáp trung quốc và hậu quả của chính sách bao cấp sau nhiều năm áp dụng'}
623
- ```
624
-
625
- ## **Acknowledgment**
626
- Our development is based on our previous works:
627
- - [Check-Fact-Question-Answering-System](https://github.com/DAVID-NGUYEN-S16/Check-Fact-Question-Answering-System)
628
- - [Extract-Evidence-Question-Answering](https://github.com/DAVID-NGUYEN-S16/Extract-evidence-question-answering)
629
-
630
- **SemViQA** is the final version we have developed for verifying fact-checking in Vietnamese, achieving state-of-the-art (SOTA) performance compared to any other system for Vietnamese.
631
-
632
- ## 📖 **Citation**
633
-
634
- If you use **SemViQA** in your research, please cite our work:
635
-
636
- ```bibtex
637
- @misc{nguyen2025semviqasemanticquestionanswering,
638
- title={SemViQA: A Semantic Question Answering System for Vietnamese Information Fact-Checking},
639
- author={Nam V. Nguyen and Dien X. Tran and Thanh T. Tran and Anh T. Hoang and Tai V. Duong and Di T. Le and Phuc-Lu Le},
640
- year={2025},
641
- eprint={2503.00955},
642
- archivePrefix={arXiv},
643
- primaryClass={cs.CL},
644
- url={https://arxiv.org/abs/2503.00955},
645
- }
646
- ```
647
-
648
- '''
649
-
650
- st.markdown(about_content, unsafe_allow_html=True)
 
180
  "NEI": "⚠️"
181
  }
182
 
183
+ # Tabs: Verify, History
184
+ tabs = st.tabs(["Verify", "History"])
185
 
186
  # --- Tab Verify ---
187
  with tabs[0]:
 
212
  evidence_time = time.time() - evidence_start_time
213
 
214
  # Classify the claim
 
215
  verdict = "NEI"
216
  details = ""
217
+ verdict_start_time = time.time()
218
  prob2class, pred_bc = 0, "Not used"
219
  prob3class, pred_tc = classify_claim(
220
  claim, evidence, model_tc, tokenizer_tc,
 
226
  "cuda" if torch.cuda.is_available() else "cpu"
227
  )
228
  verdict = "SUPPORTED" if pred_bc == 0 else "REFUTED" if prob2class > prob3class else ["NEI", "SUPPORTED", "REFUTED"][pred_tc]
229
+ verdict_time = time.time() - verdict_start_time
230
  if show_details:
231
  details = f"""
232
+ 3-Class Probability: {prob3class.item():.2f}
233
+ 3-Class Predicted Label: {['NEI', 'SUPPORTED', 'REFUTED'][pred_tc]}
234
+ 2-Class Probability: {prob2class.item():.2f}
235
+ 2-Class Predicted Label: {['SUPPORTED', 'REFUTED'][pred_bc]}
236
  """
237
+ total_time = time.time() - start_time
 
 
 
 
 
 
 
 
 
 
238
  st.session_state.latest_result = {
239
  "claim": claim,
240
  "evidence": evidence,
241
  "verdict": verdict,
242
  "evidence_time": evidence_time,
243
  "verdict_time": verdict_time,
244
+ "total_time": total_time,
245
+ "details": details,
246
+ "qatc_model": qatc_model_name,
247
+ "bc_model": bc_model_name,
248
+ "tc_model": tc_model_name
249
  }
250
 
251
  if torch.cuda.is_available():
 
260
  <p class='verdict'><span class='verdict-icon'>{verdict_icons.get(res['verdict'], '')}</span>{res['verdict']}</p>
261
  <p><strong>Evidence Inference Time:</strong> {res['evidence_time']:.2f} seconds</p>
262
  <p><strong>Verdict Inference Time:</strong> {res['verdict_time']:.2f} seconds</p>
263
+ <p><strong>Total Execution Time:</strong> {res['total_time']:.2f} seconds</p>
264
+ <p><strong>QATC Model:</strong> {res['qatc_model']}</p>
265
+ <p><strong>Binary Classification Model:</strong> {res['bc_model']}</p>
266
+ <p><strong>3-Class Classification Model:</strong> {res['tc_model']}</p>
267
  {res['details']}
268
  </div>
269
  """, unsafe_allow_html=True)
 
289
  st.markdown(f"**{idx}. Claim:** {record['claim']} \n**Result:** {verdict_icons.get(record['verdict'], '')} {record['verdict']}")
290
  else:
291
  st.write("No verification history yet.")