# obaskly/aitextdetectionbypass architecture

> Architecture diagram of the GitHub repository obaskly/aitextdetectionbypass, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/obaskly/aitextdetectionbypass
- Repository: https://github.com/obaskly/aitextdetectionbypass

## Overview

##### Main Components
- GUI / Entry Point: Represented by gui.py – this is the main interface that users interact with to run the paraphrasing tasks.
- Paraphrasing Engine: Implemented in paraphraser.py which likely contains the core logic to interact with undetectable.ai to transform content.
- File Processing Module: Contained in the file_processing folder (reader.py and save_paraphrased_doc.py) – for reading input files (TXT, DOCX, PDF) and saving the paraphrased output.
- API and Email Management:
- api_grabber.py handles extraction of API keys from stored JSON data.
- utils/email_utils.py along with other utilities in the utils folder (automation_utils.py, text_splitter.py) manage email functions, Gmail registration/verification, and text chunking.
- AI Detection Module: Represented by ai_scanner.py which scans the text for AI detection percentage.
- External Integrations & Configuration:
- json_files folder holds the credentials (e.g., credentials.json required for Gmail API access).
- The external undetectable.ai platform and Google’s Gmail API services act as external dependencies.

##### Relationships and Interactions
- The GUI (gui.py) is the central orchestrator. When the user starts the process, the GUI:
- Invokes the File Processing Module to load and extract text from files.
- Uses utils/text_splitter.py to break the text into manageable chunks.
- Calls paraphraser.py to process each chunk via the undetectable.ai API.
- Leverages automation_utils.py and email_utils.py to manage Gmail-based registration/verification and API key storage/extraction (with api_grabber.py).
- Optionally routes the processed text through ai_scanner.py to check AI detection percentage.
- Finally, uses file_processing/save_paraphrased_doc.py to store the output.
- Each module interacts in a pipeline-like fashion, where data (text chunks and API keys) flows from one component to another.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Each file or module has a distinct responsibility – UI (gui.py), paraphrasing (paraphraser.py), file I/O (file_processing), and utility functions (utils).
- Modularity & Reusability: The project splits key functionalities into separate modules that can be maintained or extended independently.
- External Service Integration: The design clearly abstracts external API interactions (both undetectable.ai and the Gmail API) from the business logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subgraph: User Interaction
    subgraph "User Interaction"
        A["GUI (gui.py)"]:::gui
    end

    %% Subgraph: File Processing & Core
    subgraph "Core Processing"
        B["File Reading (file_processing/reader.py)"]:::core
        C["Text Splitting (utils/text_splitter.py)"]:::utility
        D["Paraphrasing Engine (paraphraser.py)"]:::core
        E["AI Detection (ai_scanner.py)"]:::core
        F["File Saving (file_processing/save_paraphrased_doc.py)"]:::core
    end

    %% Subgraph: API & Email Management
    subgraph "API and Email Management"
        G["API Key Extraction (api_grabber.py)"]:::utility
        H["Email Management (utils/email_utils.py)"]:::utility
        I["Automation Utilities (utils/automation_utils.py)"]:::utility
    end

    %% Subgraph: External Services
    subgraph "External Services"
        J["undetectable.ai API"]:::external
        K["Gmail API"]:::external
        L["Credentials (json_files)"]:::external
    end

    %% Data Flow Connections
    A -->|"load file"| B
    B -->|"read text"| C
    C -->|"send text chunk"| D
    D -->|"output text"| F
    D -->|"check for AI detection"| E
    E -->|"feedback"| F

    %% API and Email Management Connections
    A -->|"request API key"| G
    G -->|"retrieve key"| L
    A -->|"initiate email management"| H
    H -->|"utilize automation"| I
    I -->|"access"| K

    %% External API Calls from Paraphraser and Email Modules
    D -->|"calls"| J
    H -->|"uses credentials"| L

    %% Styling Classes
    class A gui
    class B,D,F,E core
    class C,G,H,I utility
    class J,K,L external

    %% Click Events
    click A "https://github.com/obaskly/aitextdetectionbypass/blob/main/gui.py"
    click B "https://github.com/obaskly/aitextdetectionbypass/blob/main/file_processing/reader.py"
    click C "https://github.com/obaskly/aitextdetectionbypass/blob/main/utils/text_splitter.py"
    click D "https://github.com/obaskly/aitextdetectionbypass/blob/main/paraphraser.py"
    click E "https://github.com/obaskly/aitextdetectionbypass/blob/main/ai_scanner.py"
    click F "https://github.com/obaskly/aitextdetectionbypass/blob/main/file_processing/save_paraphrased_doc.py"
    click G "https://github.com/obaskly/aitextdetectionbypass/blob/main/api_grabber.py"
    click H "https://github.com/obaskly/aitextdetectionbypass/blob/main/utils/email_utils.py"
    click I "https://github.com/obaskly/aitextdetectionbypass/blob/main/utils/automation_utils.py"
    click L "https://github.com/obaskly/aitextdetectionbypass/tree/main/json_files"
    
    %% Note: External nodes J and K are integrations and do not have file paths.
    
    %% Class Definitions (with colors)
    classDef gui fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef core fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef utility fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef external fill:#fff2cc,stroke:#333,stroke-width:2px;
```
