Skip to content

DeepRatAI/TrueEye

TrueEye Banner

License: MIT Python 3.10+ FastAPI LangFlow Ready NixOS

🧿 TrueEye β€” Intelligent Media Literacy System

TrueEye is an AI‑powered tool designed to analyze news articles and web content to detect narrative bias, identify the target audience and reveal hidden intentions or manipulative rhetorical structures. In other words, it doesn't just detect fake news β€” it analyzes who the content is written for and why.

This repository provides a production‑grade Python package containing both the REST API and a simple frontend. The code is structured under src/trueeye with proper type hints, tests, continuous integration and development tooling. A local analysis stub is provided for offline testing.

πŸš€ Demo

The previous Hugging Face Space demo is no longer maintained. You can run your own instance locally using the instructions below.

πŸš€ Usage Options

TrueEye offers two usage modes depending on your needs:

πŸ—οΈ Option A: Complete Application (Recommended for production)

  • βœ… Modern web interface with custom UI
  • βœ… Robust REST API with FastAPI
  • βœ… Reproducible environment with Nix/NixOS
  • βœ… Automatic setup with a single command
  • βœ… Integrated tests and complete documentation
  • βœ… Offline mode for development without external APIs

πŸ‘‰ Quick start: ./start.sh (See complete instructions below)

⚑ Option B: Direct LangFlow Flow (Quick to try)

  • βœ… 5-minute setup by importing TrueEyeBeta.json
  • βœ… No complex configurations - just import and use
  • βœ… Visual playground integrated in LangFlow
  • βœ… Easy to modify prompts and logic from the UI
  • βœ… Cross-platform - works on any OS

πŸ‘‰ See: README_FLOW.md for flow instructions


🧩 What Does TrueEye Do?

When given a news article URL, TrueEye performs three consecutive analyses:

  1. Bias & Narrative Tone β€” Detects narrative polarity (positive, negative, neutral), identifies rhetorical strategies (fear, polarization, irony) and summarizes the content while flagging questionable claims.
  2. Audience Profiling β€” Infers demographic and emotional profile of the target reader and identifies values, beliefs or cognitive biases being exploited.
  3. Intent & Risk Evaluation β€” Detects manipulative discourse or hidden agendas and highlights information gaps and potential societal risk.

The report includes links to trustworthy sources for fact‑checking.

βš™οΈ Architecture Overview

The project consists of two main components:

  • 🧠 Backend β€” A REST API built with FastAPI and packaged as a Python library. The API is created via trueeye.create_app() and can be run using uvicorn.
  • 🧱 Frontend β€” A minimal static web interface built with TailwindCSS (served from the package's static directory). It allows users to input a URL, trigger analysis and view the result.

The heavy lifting is performed by a remote LangFlow pipeline via the FLOW_API_URL environment variable. For offline testing you can set TE_PROVIDER=local and the API will return a stubbed response.

πŸ“ Project Structure

TrueEye_v1/
β”œβ”€β”€ src/trueeye/
β”‚   β”œβ”€β”€ __init__.py      # Exposes create_app()
β”‚   β”œβ”€β”€ api.py           # FastAPI application factory and endpoints
β”‚   β”œβ”€β”€ models.py        # Pydantic models
β”‚   β”œβ”€β”€ utils.py         # Helper functions
β”‚   └── static/
β”‚       └── index.html   # Frontend UI
β”œβ”€β”€ tests/               # Test suite
β”œβ”€β”€ pyproject.toml       # Project metadata and dependencies
β”œβ”€β”€ .pre-commit-config.yaml
β”œβ”€β”€ .github/workflows/ci.yml
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ CODE_OF_CONDUCT.md
β”œβ”€β”€ SECURITY.md
β”œβ”€β”€ LICENSE.txt          # Non‑commercial license
└── README.md            # Project documentation (this file)

πŸ’» Running on NixOS/Nix

πŸš€ Quick Start (One Command)

# Option 1: Using start.sh script (recommended)
./start.sh

# Option 2: Using Makefile
make start

# Option 3: Direct Nix command
nix-shell --run "trueeye-dev"

πŸ”§ Initial Setup

The project includes automatic configuration. On first use:

  1. An .env file will be automatically created from .env.example
  2. The Python environment will be configured with all dependencies
  3. The application will start in local mode (no external connection)

βš™οΈ Environment Variables Configuration

# To edit configuration:
./start.sh config
# or
make config

# For manual configuration:
cp .env.example .env
# Then edit .env with your favorite editor

Main variables:

  • TE_PROVIDER=local β†’ Test mode (no external API)
  • TE_PROVIDER=remote β†’ Production mode (requires FLOW_API_URL)
  • PORT=8000 β†’ Server port
  • HOST=0.0.0.0 β†’ Server host

πŸ§ͺ Available Commands

# Commands with start.sh:
./start.sh start    # Start application (default)
./start.sh test     # Run tests
./start.sh config   # Edit configuration
./start.sh shell    # Open development shell
./start.sh help     # Show help

# Commands with Makefile:
make start         # Start application
make test          # Run tests
make config        # Edit configuration
make shell         # Open development shell
make clean         # Clean temporary files
make check         # Verify configuration
make help          # Show help

πŸ—οΈ Estructura del Proyecto

🐚 Nix Development Shell

The project includes a fully configured shell.nix that provides:

  • βœ… Python 3.10+ with all dependencies
  • βœ… FastAPI and Uvicorn pre-configured
  • βœ… Testing tools (pytest, httpx)
  • βœ… Development utilities (mypy, curl, jq)
  • βœ… Custom scripts to make usage easy
  • βœ… Automatic loading of environment variables
  • βœ… Automatic PYTHONPATH configuration

πŸ’‘ Special Features

  • Automatic configuration: Creates .env if it doesn't exist
  • Environment validation: Verifies configuration at startup
  • Multiple interfaces: Bash script, Makefile, Nix commands
  • Development mode: Auto-reload with --reload
  • Integrated testing: Test suite ready to use
  • Automatic cleanup: Temporary file management

🎯 Recommended Usage for NixOS

# 1. Clone/access the project
cd /path/to/trueeye_v1

# 2. Run (everything gets configured automatically)
./start.sh

# 3. Access the application
firefox http://localhost:8000

πŸ” System Verification

To verify that everything is properly configured:

# Verify dependencies and configuration
make check

# View environment information
make dev-info

# Run tests to validate functionality
./start.sh test

πŸ“š Technologies and Tools

Backend

  • FastAPI β€” High-performance Python web framework
  • Uvicorn β€” ASGI server with asyncio support
  • Pydantic β€” Data validation with type hints
  • Requests β€” HTTP client for API integration

Frontend

  • HTML5/JavaScript β€” Minimal and functional frontend
  • TailwindCSS β€” Utility-first CSS framework
  • Marked.js β€” Markdown processing for responses

Development

  • Nix/NixOS β€” Reproducible environment management
  • pytest β€” Testing framework
  • mypy β€” Static type checking
  • Shell Scripts β€” Task automation

Integration

  • LangFlow API β€” AI analysis pipeline (remote mode)
  • Local mode β€” Stub responses for offline development

✍️ Author

Gonzalo Romero (DeepRat)

AI, Software & Systems Engineer Β· Prompt Engineer Β· Full‑Stack Developer

πŸ”— Web | Hugging Face | GitHub | LinkedIn | Medium