Skip to content

Repository files navigation

๐Ÿง  Infinity AI Hub - Self-Learning Conversational AI Engine

GitHub Stars

โญ If you find this project useful, please give it a Star on GitHub! It helps the project grow.

License: MIT

A lightweight Python AI engine built from scratch with an interactive Flask Web Hub UI, live self-learning, multi-query processing, dynamic math solving, and automated JSON memory management.


๐Ÿš€ Core Features & Capabilities

  • ๐ŸŒ Interactive Web Interface (app.py): Modern Flask UI featuring live model switching between v7.0 Neural and v5.6 Legacy, real-time JSON memory selection, dynamic engine notices, and automated cleanup of empty memory files.

  • ๐Ÿง  Live Interactive Training: If the AI doesn't understand a query, it interactively asks for the correct response and updates its persistent memory instantly.

  • โšก Auto-Fallback Engine: Seamlessly detects local dependencies such as TensorFlow and safely falls back between v7.0 and v5.6 without freezing the session.

  • ๐Ÿงฎ Dynamic Math Solver: Instantly evaluates arithmetic expressions embedded directly within text queries.

  • ๐Ÿ”€ Multi-Sentence Splitting: Breaks down complex user inputs joined by commas or connectors and processes the queries sequentially.

  • ๐Ÿค Smart Memory Merging: Safely merges training data from multiple JSON files into a master memory without data loss.


๐Ÿ“ Project Structure & Files

File Name Purpose Key Concept
app.py Web Hub Server Flask server powering the Web Hub UI, model switching, JSON memory selection, and automatic cleanup.
v5_6_AI_engine.py v5.6 Legacy Engine Fast, lightweight rule-based engine with live training and arithmetic solving.
main_engine.py v7.0 Neural Engine TensorFlow-powered engine for advanced intent classification.
merge_memory.py Memory Merger Safely merges multi-user JSON training files into a master memory file.
requirements.txt Python Dependencies Lists the external Python packages required by Infinity AI Hub.
ai_memory_*.json Persistent AI Memory JSON databases storing trained patterns, intents, and custom user responses
LICENSE Project License MIT License information
knowledge.db Offline Knowledge Base SQLite database storing pre-built facts, fallback responses, and general knowledge queries.

๐Ÿ› ๏ธ How to Run & Use

1. โ–ถ๏ธ Start the Web Server

Open your terminal in the project directory and run:

python app.py

Then open your browser and navigate to:

http://127.0.0.1:5000


2. ๐ŸŽ›๏ธ Features on the Web Hub

๐Ÿ”„ Switch Models

Use the header dropdown to switch between:

  • v7.0 โ€” Neural Engine
  • v5.6 โ€” Legacy Engine

You can change the active engine directly from the Web Hub.

๐Ÿง  Select Active Memory

Switch between available .json memory files instantly without restarting the server.

โž• Create New JSON

Click โž• New JSON to create a fresh user memory/session.

The Web Hub automatically scans memory files and cleans up empty memory files when required.


3. ๐Ÿง  Live Training in Chat

Chat naturally with the AI.

If an input is unrecognized, the AI will ask:

"Mujhe iska matlab nahi pata... toh kya jawab doon?"

Simply type the response you want the AI to learn.

The response is then saved permanently into the currently active .json memory file.

This allows the AI to continuously expand its knowledge through interaction.


4. ๐Ÿงฎ Dynamic Math Solver

The AI can detect arithmetic expressions directly inside normal text queries and calculate them automatically.

For example:

What is 25 + 75?

The engine can process the mathematical expression and return the result without requiring a separate calculator mode.


5. ๐Ÿ”€ Multi-Sentence Processing

The engine can split complex user inputs into multiple smaller queries.

This allows the AI to process several requests from a single user message instead of treating the entire message as one query.

Example:

Hello, what is AI, how are you?

The engine can process the individual parts sequentially.


6. โšก Automatic Engine Fallback

Infinity AI Hub supports two engine versions:

  • v7.0 Neural Engine
  • v5.6 Legacy Engine

Fallback Flow

             v7.0 Neural Engine
                      โ”‚
                      โ–ผ
             TensorFlow Available?
                 โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”
                YES        NO
                 โ”‚          โ”‚
                 โ–ผ          โ–ผ
               v7.0       v5.6
              Neural      Legacy

If required local dependencies such as TensorFlow are unavailable, the system can safely fall back to the v5.6 Legacy Engine.

This helps keep the chat session running instead of failing because of a missing dependency.


7. ๐Ÿ”€ Merge Friend Memories

To combine training data from multiple JSON memory files, place the exported memory files in the project directory and run:

python merge_memory.py

The memory merger combines the training data into the master memory while protecting existing priority data.


๐Ÿ› ๏ธ Typical Workflow

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚    Run app.py   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
                                  โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚ Open 127.0.0.1:5000      โ”‚
                    โ”‚ in Browser               โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚ Select Engine             โ”‚
                    โ”‚ v7.0 Neural / v5.6 Legacyโ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚ Select Active Memory File โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                                 โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   Chat with AI โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                  โ”‚              โ”‚              โ”‚
                  โ–ผ              โ–ผ              โ–ผ
             Math Query     Known Query    Unknown Query
                  โ”‚              โ”‚              โ”‚
                  โ–ผ              โ–ผ              โ–ผ
           Instant Answer    AI Response   Ask for Answer
                                                 โ”‚
                                                 โ–ผ
                                      User Provides Response
                                                 โ”‚
                                                 โ–ผ
                                      Response Saved to Memory
                                                 โ”‚
                                                 โ–ผ
                                            AI Learns
                                                 โ”‚
                                                 โ–ผ
                                      Merge JSONs When Needed
                                                 โ”‚
                                                 โ–ผ
                                      python merge_memory.py

๐Ÿ“ฆ Quick Start

Step 1 โ€” Install Dependencies

Install the required Python packages from requirements.txt:

pip install -r requirements.txt

Step 2 โ€” Start Infinity AI Hub

python app.py

Step 3 โ€” Open the Web Hub

http://127.0.0.1:5000

Step 4 โ€” Choose Your Engine

v7.0 Neural
     or
v5.6 Legacy

Step 5 โ€” Select Your Memory

Choose an existing .json memory file or create a new one.

Step 6 โ€” Start Chatting

Ask questions, solve math problems, and train the AI with new responses.

Step 7 โ€” Merge Memories

When you have training data from multiple users:

python merge_memory.py

๐Ÿง  Infinity AI Hub Architecture

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚   Infinity AI Hub   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚       app.py        โ”‚
                         โ”‚    Flask Web Hub    โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                     โ”‚                             โ”‚
                     โ–ผ                             โ–ผ
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚     v7.0 Neural     โ”‚       โ”‚     v5.6 Legacy     โ”‚
          โ”‚    main_engine.py   โ”‚       โ”‚ v5_6_AI_engine.py   โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚                             โ”‚
                     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                                    โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚  ai_memory_*.json   โ”‚
                         โ”‚  Persistent Memory  โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ–ฒ
                                    โ”‚
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚  merge_memory.py    โ”‚
                         โ”‚   Memory Merger     โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽฏ Project Goal

Infinity AI Hub is designed as a lightweight, self-learning conversational AI system that can:

  • ๐Ÿ’ฌ Chat with users
  • ๐Ÿง  Learn from new conversations
  • ๐Ÿ’พ Store knowledge in JSON memory
  • ๐Ÿ“š Retrieve offline factual data via SQLite (knowledge.db)
  • ๐Ÿ”„ Switch between AI engine versions
  • โšก Automatically fall back when dependencies are unavailable
  • ๐Ÿงฎ Solve mathematical expressions
  • ๐Ÿ”€ Process multiple queries
  • ๐Ÿค Merge knowledge from multiple users
  • ๐Ÿ“„ Extract and process text from PDF files
  • ๐Ÿ–ผ๏ธ Read text from images using OCR
  • ๐ŸŒ Provide an easy-to-use Flask Web Hub

๐Ÿ“Œ Main Commands

Start the Web Hub

python app.py

Merge AI Memories

python merge_memory.py

๐Ÿ“œ License

Infinity AI Hub is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2026 infinityminds-dev


โค๏ธ Built From Scratch

Infinity AI Hub is a lightweight AI project focused on experimentation, self-learning, persistent memory, and conversational AI development.

Built from scratch with the goal of creating a system that can continuously learn, remember, and improve through interaction.


โญ Support the Project

If you like Infinity AI Hub and want to support its development:

  • Give this repository a Star โญ๏ธ
  • Share it with other developers ๐Ÿš€
  • Report bugs or suggest features via Issues ๐Ÿ’ก

About

A light-weight, self-learning Python Conversational AI Engine featuring interactive live training, dynamic math solving, local JSON memory merging, and dual-engine architecture with web UI.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages