Spaces:
Build error
title: The Algorithm
emoji: π§
colorFrom: pink
colorTo: red
sdk: docker
app_port: 7860
pinned: false
license: mit
short_description: AI-powered relationship analyzer β privacy-first, BYOK.
The Algorithm
A paranoid-level, privacy-first AI relationship analyzer.
Stop sending your most intimate chat history to random servers.
π Try the Live App Here
π Overview
The Algorithm is an open-source tool that analyzes exported chat logs from WhatsApp, Telegram, Instagram, and Discord to generate comprehensive behavioral insights and relationship coaching.
Unlike other platforms that store and read your data, The Algorithm operates on a strict zero-knowledge, BYOK (Bring Your Own Key) architecture. Your chat data is parsed in volatile memory, anonymized on the edge, and instantly destroyed the millisecond the analysis completes.
β¨ Features
- Deep AI Analysis: Generate an instant "Spotify Wrapped" style report detailing communication health, attachment styles, humor synchronization, and areas for growth.
- True Cross-Platform: Natively supports chat exports from
WhatsApp (.txt),Telegram (.html),Instagram (.json), andDiscord (.json). - Bring Your Own Key (BYOK): Supports Google Gemini, Anthropic Claude, and OpenAI GPT-4o. You provide the API key; we provide the engine.
- Retro Groovy Pop-Art UI: A gorgeous, vibrant interface featuring paper grain textures, bold typography, and personality-driven design.
- Shareable Vibe Card: Export a beautifully designed snap of your relationship stats (Total Messages, Share %, Avg Response, and Mirroring).
- Customizable Analysis Tone: Control the AI's personality by choosing between Playful, Balanced, or Direct analysis modes.
π‘οΈ Zero-Knowledge Architecture
We don't want your data. Period.
- Client-Side Anonymization: Personally Identifiable Information (PII) like emails, phone numbers, and full names are heavily redacted directly in the browser before the data touches our server.
- Pure RAM Processing: We refuse to use a database. Uploaded files are streamed into active memory, parsed, and never written permenantly to disk.
- Aggressive Deletion: A strict Python
finallyblock guarantees that all temporary memory associated with your session is permanently destroyed instantly. - Stats-Only LLM Pipeline: Your raw chat logs are never sent to OpenAI, Anthropic, or Google. Our Python backend processes the chats locally and sends only an anonymous, numerical statistical payload to the LLM.
π Getting Started Locally
Running The Algorithm on your own machine takes less than two minutes.
Prerequisites
- Python 3.11+
- Virtualenv or Conda (recommended)
Installation
Clone the repository and navigate to the project directory:
git clone https://github.com/rixabhh/TheAlgorithm.git cd TheAlgorithmCreate a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txtRun the Flask application:
python app.pyOpen
http://127.0.0.1:7860in your browser.
π³ Docker Deployment
The Algorithm is fully dockerized and ready for production deployment on render, Railway, or VPS.
docker build -t the-algorithm .
docker run -p 7860:7860 the-algorithm
ποΈ Architecture Flowchart
graph TD
A[User Uploads Chat] -->|Browser| B(Client-Side Scrubbing);
B -->|Sensitive Data Masked| C[Flask Server app.py];
C -->|Memory Buffer| D{Platform Parser};
D -->|WhatsApp| E[JSON Message Array];
D -->|Telegram| E;
D -->|Instagram| E;
D -->|Discord| E;
E --> F[Analytics Engine];
F -->|Raw Stats| G[LLM Service];
G -->|API Request| H((OpenAI / Anthropic / Gemini));
H -->|JSON Report| I[Dashboard UI];
I -->|User Session Ends| J((Data Destroyed Forever));
classDef user fill:#8b5cf6,stroke:#fff,color:#fff
classDef secure fill:#22c55e,stroke:#fff,color:#fff
classDef danger fill:#f43f5e,stroke:#fff,color:#fff
class A user;
class B,J secure;
class H danger;
π Project Structure
TheAlgorithm/
βββ app.py # Main Flask application & routes
βββ core/
β βββ analytics.py # Calculates conversation statistics
β βββ llm_service.py # Handles external BYOK LLM API requests
β βββ parsers.py # Platform-specific chat parsers (WA, TG, IG, Discord)
βββ static/
β βββ css/style.css # Retro Pop-Art Vanilla CSS design system
β βββ js/ # Client-side UI logic and PII scrubbing
β βββ fonts/ # Self-hosted fonts for privacy
βββ templates/
β βββ index.html # Landing page & upload interface
β βββ dashboard.html # Analytics & Insights display
β βββ instructions.html # Export walkthroughs per platform
β βββ privacy.html # Detailed zero-knowledge policy
βββ .github/workflows/ # CI/CD and Hugging Face deployment Action
βββ requirements.txt # Python dependencies
π€ Contributors
Contributions are completely welcome! Be it adding support for a new chat platform, improving the analytical models, or refining the UI.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.