# Veracity_AI

## Overview

Veracity_AIn is designed to analyze articles and determine their authenticity using Natural Language Processing (NLP) techniques and machine learning models. The application consists of two main components: a user interface for inputting URLs or text, and a backend system that processes the data and makes predictions about the veracity of the article.

## User Interface

![Fake News Checker UI](/docs/ui/screenshot.png)

The user interface is built using CustomTkinter, a modern and customizable Python UI library. The main screen is divided into three sections:

1. **Input Section**: This section allows users to enter the URL of an article or paste the text directly into the input box.
2. **Result Section**: Displays the result of the analysis (Real or Fake) and the confidence level in percentage.
3. **Leaderboard Section**: Shows a list of news providers along with their fake news percentages, sorted by the highest fake news rate.

## Backend System

The backend system is responsible for processing user input, communicating with the database, and making predictions using the VeraMind model. Here's an overview of its components:

### Data Models
- **TextData**: Stores the URL, text content, provider, result, confidence, and a flag indicating if the news is fake.
- **Provider**: Represents a news provider with attributes for name, total articles, fake articles count, and a list of associated TextData objects.

### Database
The application uses a DuckDB database to store analyzed data. The `FakeNewsChecker` class manages database operations such as inserting new data and fetching existing data.

### Machine Learning Model
- **VeraMindInference**: An inference engine for the VeraMind model, which is used to predict whether an article is real or fake news based on its text content.
- **ArticleRater**: A class that uses the Large Language Model (LLM) to generate a response based on the analyzed text data.

## Usage

To use the Fake News Checker application, follow these steps:

1. Enter an article URL or paste the text directly into the input box.
2. Click on the "Check" button to initiate the analysis process.
3. Once the analysis is complete, the result (Real or Fake) and confidence level will be displayed in the result section.
4. The leaderboard section will automatically update with the latest news providers' fake news percentages.

## License

This application is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International. See the [LICENSE](LICENSE) file for more details.