md
This repository contains code for a misinformation detection system. While no formal description was provided, the file structure and included files suggest it is a web application with a Chrome/Firefox extension component that likely analyzes text on web pages and provides a verdict on its truthfulness, confidence score, supporting evidence and educational resources. The backend uses Python (FastAPI) and the frontend/extension uses Javascript.
- Misinformation Detection: Identifies potentially false or misleading information online.
- Verdict and Confidence Score: Provides a judgment on the truthfulness of the content and a measure of confidence in that judgment.
- Evidence Snippets: Highlights supporting evidence for the verdict with clickable sources.
- Transparency Panel: Shows the factors contributing to the verdict.
- Educational Resources: Offers educational tips to help users understand the issue.
- Chrome Extension: Integrates directly with the user's web browsing experience.
- API Backend: Provides a robust and scalable infrastructure for the system.
Before you begin, ensure you have the following installed:
- Python: Version 3.11 or higher.
- Docker: For containerization and simplified deployment (optional).
- Node.js and npm: For building the Chrome extension (if modifying extension).
- Web Browser: Google Chrome (required for the extension).
The Python backend also depends on the following libraries, which are listed in backend/requirements.txt:
- fastapi==0.101.0
- uvicorn[standard]==0.22.0
- requests==2.31.0
- python-dotenv==1.0.0
- google-generativeai==0.8.5
-
Clone the repository:
git clone https://github.com/Garvnanda/MISINFORMATION-DETECTOR.git cd MISINFORMATION-DETECTOR -
Navigate to the backend directory:
cd backend -
Create a virtual environment (recommended):
python3 -m venv venv source venv/bin/activate # On Linux/macOS # venv\Scripts\activate # On Windows
-
Install the dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Copy the content of
.env.example(if provided, create your own version of it named.env) - Populate the
.envfile with the necessary keys and values, such as API keys (if applicable).
- Copy the content of
-
Run the backend using Uvicorn:
uvicorn main:app --host 0.0.0.0 --port 8000
Alternatively, you can use the
run_local.shscript (if available):./run_local.sh
-
Navigate to the
extensiondirectory:cd extension -
Open Chrome and go to
chrome://extensions/ -
Enable "Developer mode" in the top right corner.
-
Click "Load unpacked" and select the
extensiondirectory in this repository. -
The extension should now be installed and active in your Chrome browser.
-
Build the Docker image:
docker build -t misinformation-detector-backend . -
Run the Docker container:
docker run -d -p 8000:8000 misinformation-detector-backend
This will start the backend server in a Docker container, accessible at
http://localhost:8000.
The backend provides a REST API. Here are some example endpoints (inferred based on the code):
-
/(GET): Likely a health check or simple welcome message.curl http://localhost:8000/
-
/analyze(POST): Likely takes text as input and returns the analysis results. Example:curl -X POST -H "Content-Type: application/json" -d '{"text": "This is a test sentence."}' http://localhost:8000/analyze
The response would likely be a JSON object containing the verdict, confidence score, evidence snippets, and the transparency panel data.
Note: Without further documentation or descriptions, the exact API endpoints and request/response formats are speculative and require further investigation of backend/main.py.
- Browse to a webpage.
- Highlight a text snippet you want to analyze, or activate page analysis.
- The extension will send the text to the backend API.
- The extension will display the analysis results (verdict, confidence score, evidence, etc.) in a popup or embedded panel.
The backend can be configured using environment variables. The following variables are likely used (inferred from backend/main.py and the presence of python-dotenv):
- PORT: The port the backend server listens on (default: 8000).
- Any API keys: Possibly Google API key for GenAI or Search API keys. These should be stored as environment variables.
These environment variables can be set in a .env file in the backend directory, or directly in the system's environment.
We welcome contributions to improve this project! Here are some guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with clear and concise messages.
- Submit a pull request with a detailed description of your changes.
This project is licensed under the MIT License - see the LICENSE file for details.
- The project structure suggests the use of certain technologies such as FastAPI, Google Generative AI, and potentially other third-party resources. These libraries and resources are acknowledged for their contribution to this project.