CHRISDANIEL145 commited on
Commit
ab60b70
Β·
1 Parent(s): 9c69431

Update README with comprehensive system documentation

Browse files
Files changed (1) hide show
  1. README.md +169 -2
README.md CHANGED
@@ -1,2 +1,169 @@
1
- # TruthCheck-App
2
- An intelligent fact-checking tool would not only help users verify the accuracy of digital content instantly but also foster greater transparency and accountability in online communication..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TruthCheck: AI-Powered Fact Verification System
2
+
3
+ ![Status](https://img.shields.io/badge/Status-Active-success)
4
+ ![Python](https://img.shields.io/badge/Python-3.10%2B-blue)
5
+ ![License](https://img.shields.io/badge/License-MIT-green)
6
+
7
+ A state-of-the-art **Automated Fact-Checking System** that uses a multi-stage neural pipeline to verify text claims in real-time. It combines **Web Scraping**, **Semantic Search**, and **Natural Language Inference (NLI)** to determine the truthfulness of statements with high precision.
8
+
9
+ ---
10
+
11
+ ## 🌟 Key Features
12
+
13
+ ### 🧠 Advanced AI Core
14
+ - **Multi-Model Consensus**: Aggregates judgments from `RoBERTa-large-MNLI` and `DeBERTa-v3-large` for robust accuracy.
15
+ - **Semantic Filtering**: Uses `Sentence-Transformers` to ensure only relevant evidence is analyzed.
16
+ - **Credibility Weighting**: Automatically assigns higher trust scores to `.gov`, `.edu`, and scientific domains.
17
+
18
+ ### πŸ’» Modern "Cyber-Noir" Interface
19
+ - **Futuristic UI**: deep space blue theme with neon cyan/purple accents using **Tailwind CSS**.
20
+ - **Real-Time Dashboard**: Track system stats, truth rates, and scan history in the Command Center.
21
+ - **Interactive Visuals**: Animated confidence gauges, evidence streams, and live "scanning" effects.
22
+
23
+ ### βš™οΈ Enterprise-Ready
24
+ - **REST API**: Fully documented endpoint (`/api/verify`) for external integration.
25
+ - **Persistence**: Built-in SQLite database stores all verification history.
26
+ - **Scalable Architecture**: Modular design separating Extraction, Retrieval, and Classification layers.
27
+
28
+ ---
29
+
30
+ ## πŸ›οΈ System Architecture (Top-to-Bottom)
31
+
32
+ The application follows a strictly layered pipeline architecture:
33
+
34
+ 1. **Input Layer**:
35
+ - User submits a claim via the **Web UI** or **API**.
36
+ - The `ClaimExtractor` identifies factual statements using **spaCy**.
37
+
38
+ 2. **Retrieval Layer**:
39
+ - `KeywordExtractor` pulls search terms (Entities/Nouns).
40
+ - `EvidenceRetriever` scrapes trusted sources (Wikipedia, Google, DuckDuckGo).
41
+ - Evidence is filtered by domain credibility and semantic similarity.
42
+
43
+ 3. **Inference Layer (The "Brain")**:
44
+ - Filtered evidence is paired with the claim (Premise + Hypothesis).
45
+ - **NLI Models** classify each pair as `Entailment`, `Contradiction`, or `Neutral`.
46
+ - A weighted voting algorithm calculates the final **Verdict** and **Confidence Score**.
47
+
48
+ 4. **Presentation Layer**:
49
+ - Results are returned to the user with a color-coded verdict (Green/Red/Amber).
50
+ - Data is archived in the `history.db` SQLite database.
51
+
52
+ ---
53
+
54
+ ## πŸš€ Installation & Setup Guide
55
+
56
+ Follow these steps to deploy the system locally.
57
+
58
+ ### Prerequisites
59
+ - **Python 3.10+** installed.
60
+ - **Git** installed.
61
+ - Internet connection (for downloading models).
62
+
63
+ ### Step 1: Clone the Repository
64
+ ```bash
65
+ git clone https://github.com/CHRISDANIEL145/truth-check.git
66
+ cd truth-check
67
+ ```
68
+
69
+ ### Step 2: Create Virtual Environment
70
+ Isolate dependencies to avoid conflicts.
71
+ ```bash
72
+ # Windows
73
+ python -m venv venv
74
+ .\venv\Scripts\activate
75
+
76
+ # Linux/Mac
77
+ python3 -m venv venv
78
+ source venv/bin/activate
79
+ ```
80
+
81
+ ### Step 3: Install Dependencies
82
+ This will install PyTorch, Transformers, spaCy, and Flask.
83
+ ```bash
84
+ pip install -r requirements.txt
85
+ ```
86
+
87
+ ### Step 4: Download Language Models
88
+ Pre-download the necessary NLI and spaCy models.
89
+ ```bash
90
+ python -m spacy download en_core_web_sm
91
+ ```
92
+ *Note: The Transformer models (RoBERTa/DeBERTa) will automatically download on the first run (approx. 3GB).*
93
+
94
+ ### Step 5: Run the Application
95
+ Start the Flask server.
96
+ ```bash
97
+ python run.py
98
+ ```
99
+ You should see output indicating the server is running on `http://127.0.0.1:5000`.
100
+
101
+ ---
102
+
103
+ ## πŸ“– Usage Guide
104
+
105
+ ### 1. Using the Analyzer
106
+ - Navigate to `http://127.0.0.1:5000`.
107
+ - Type a factual claim (e.g., *"The Great Wall of China is visible from space"*).
108
+ - Click **INIT_SCAN**.
109
+ - View the Verdict, Confidence Score, and supporting/contradicting Evidence.
110
+
111
+ ### 2. The Dashboard
112
+ - Click **Dashboard** in the top navigation.
113
+ - View global statistics (Truth Rate, Total Scans).
114
+ - Review your complete verification history.
115
+
116
+ ### 3. API Integration
117
+ Invoke the verification engine programmatically:
118
+
119
+ **Endpoint:** `POST /api/verify`
120
+
121
+ **Request:**
122
+ ```json
123
+ {
124
+ "claim": "Water boils at 100 degrees Celsius."
125
+ }
126
+ ```
127
+
128
+ **Response:**
129
+ ```json
130
+ {
131
+ "label": "True",
132
+ "confidence": 0.99,
133
+ "evidence": "..."
134
+ }
135
+ ```
136
+
137
+ ---
138
+
139
+ ## πŸ“‚ Project Structure
140
+
141
+ ```
142
+ TruthCheck/
143
+ β”œβ”€β”€ app.py # Main Flask application & routes
144
+ β”œβ”€β”€ run.py # Entry point
145
+ β”œβ”€β”€ history.db # SQLite database (auto-created)
146
+ β”œβ”€β”€ models/ # AI Core
147
+ β”‚ β”œβ”€β”€ claim_extractor.py # Identifies claims
148
+ β”‚ β”œβ”€β”€ evidence_retriever.py # Web scraping logic
149
+ β”‚ β”œβ”€β”€ keyword_extractor.py # NLP keyword extraction
150
+ β”‚ └── nli_classifier.py # RoBERTa/DeBERTa inference pipeline
151
+ β”œβ”€β”€ static/ # Frontend Assets
152
+ β”‚ β”œβ”€β”€ css/style.css # Custom animations & styles
153
+ β”‚ └── js/main.js # Frontend logic
154
+ β”œβ”€β”€ templates/ # HTML Views
155
+ β”‚ β”œβ”€β”€ index.html # Analyzer UI
156
+ β”‚ β”œβ”€β”€ dashboard.html # Stats & History
157
+ β”‚ β”œβ”€β”€ how_it_works.html # Architecture Docs
158
+ β”‚ └── api.html # API Docs
159
+ └── utils/ # Helpers
160
+ └── config.py # App configuration
161
+ ```
162
+
163
+ ---
164
+
165
+ ## 🀝 Contributing
166
+ Contributions are welcome! Please fork the repository and submit a Pull Request.
167
+
168
+ ## πŸ“„ License
169
+ This project is licensed under the MIT License.