Bias Checker is a full-stack application designed to analyze media text for sentiment, bias, and tone. The system provides both raw analysis results and AI-assisted summaries to help users better understand potential bias patterns in written content.
This repository contains:
- A React-based frontend for user interaction and visualization
- A FastAPI backend that performs NLP analysis using multiple models
- Auto-generated backend documentation built with Sphinx
The frontend is built using the Fusion Starter React template and provides an interactive dashboard for submitting text, selecting analysis types, and viewing results through charts and summaries.
Important: Running this project requires two terminal windows:
- One for the frontend
- One for the backend
Ensure Node.js is installed and available in your system PATH, then install PNPM:
npm install -g pnpmFrom the frontend/ directory:
pnpm installIf you receive a warning about ignored build scripts such as:
Ignored build scripts: @swc/core, esbuild
Approve them with:
pnpm approve-builds @swc/core esbuildIf no items are listed, you may safely continue.
In Terminal 1, navigate to the frontend directory:
cd frontend
pnpm devBy default, the frontend runs on port 8080.
To specify a custom port (e.g., if 8080 is in use):
pnpm dev -- --port 5174 --hostAccess the application at:
- http://localhost:8080
- or http://localhost:5174 (if changed)
The backend handles text processing, model inference, summarization, and API routing. It exposes REST endpoints that the frontend consumes.
From the backend/ directory:
pip install -r requirements.txtThis installs all required backend dependencies.
In Terminal 2, navigate to the backend directory:
cd backend
uvicorn main:app --reloadNote: The command
uvicorn backend.main:app --reloadis not supported in this project and may fail due to earlier Docker-related experimentation. Always run the backend from inside thebackend/directory using the command above.
The backend runs on http://127.0.0.1:8000 by default.
The frontend communicates with the backend through REST API calls.
Example API endpoint:
fetch("http://127.0.0.1:8000/api/analyze")Ensure the frontend is configured to point to the correct backend port if you change the default.
The backend is fully documented using Sphinx autodoc, which generates HTML documentation directly from Python docstrings in the source code.
After generating the documentation with Sphinx, open the following file in a web browser:
docs/_build/html/index.html
The documentation includes:
- Backend modules and functions
- API endpoint descriptions
- NLP model execution logic
- Parameter and return-value details
This documentation is intended to support future maintenance, extension, or handoff of the project.
When running the backend, Python automatically generates a __pycache__/ directory containing compiled bytecode files.
Example:
main.cpython-312.pyc
These files should not be committed to version control. Ensure they are ignored or removed before pushing changes.
-
Frontend: React (Fusion Starter) Start with
pnpm dev(default port: 8080) -
Backend: FastAPI (Python) Start with
uvicorn backend.main:app --reload(default port: 8000) -
Documentation: Auto-generated using Sphinx and located in
docs/_build/html/
