Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

AiLens

AiLens is a full-stack web application designed to analyze text and scanned document images to determine whether content was generated by AI. The application features real-time AI probability scoring, supporting raw text input as well as image-based text extraction using optical character recognition (OCR).


Project Overview

  • Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS v4, and Tesseract.js for OCR.
  • Backend: FastAPI with PyTorch and Hugging Face Transformers for inference.
  • Model: desklib/ai-text-detector-v1.01 sequence classification model.

Frontend Setup

Dependencies

  • Next.js (16.3.0): React framework for server rendering and static site generation
  • React / React DOM (19.2.8): UI component library
  • Axios (^1.19.0): HTTP client for backend API interaction
  • Tesseract.js (^7.0.0): Optical character recognition engine for extracting text from images
  • Tailwind CSS (^4) & PostCSS: Utility-first CSS styling
  • TypeScript (^5): Static type checking

Installation and Usage

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Run the development server:

    npm run dev
  4. Access the application at http://localhost:3000.


Backend Setup

Environment and Version Compatibility

Important Compatibility Note: The underlying model architecture is incompatible with newer versions of Hugging Face transformers.

  • Python Version: Requires Python 3.12 (>=3.12).
  • Transformers Version: Strictly pinned to transformers==4.44.2.

Dependencies

  • transformers==4.44.2
  • torch>=2.13.0
  • fastapi>=0.141.1
  • uvicorn>=0.52.1
  • accelerate>=1.14.0
  • pydantic>=2.13.4

Installation and Usage

Method 1: Using uv (Recommended)

  1. Navigate to the backend directory:

    cd backend
  2. Synchronize dependencies and set up the virtual environment:

    uv sync
  3. Start the FastAPI backend server:

    uv run uvicorn main:app --reload

Method 2: Using Standard venv and pip

  1. Navigate to the backend directory:

    cd backend
  2. Create a virtual environment using Python 3.12:

    python3.12 -m venv .venv
  3. Activate the virtual environment:

    • Windows (PowerShell):
      .venv\Scripts\Activate.ps1
    • Linux / macOS:
      source .venv/bin/activate
  4. Install required packages:

    pip install "transformers==4.44.2" "torch>=2.13.0" "fastapi>=0.141.1" "uvicorn>=0.52.1" "accelerate>=1.14.0" "pydantic>=2.13.4"
  5. Start the backend server:

    uvicorn main:app --reload

The backend server will be available at http://localhost:8000.


Model Credits

This application utilizes the open-weight AI text detection model:

Credit belongs to Desklib for providing and publishing this AI text detection model.

About

AiLens is a full-stack web application that analyzes text or scanned document images to detect AI-generated content, providing real-time probability scores through text input and OCR-based image processing.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages