Skip to content

goldstac/Lightweight-QA-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Lightweight-QA-Bot πŸ€–

A snappy, CPU-friendly chatbot that learns from your Q&A and responds in real-time! Built with Python, MiniBot uses Sentence Transformers for embeddings and cosine similarity to find the best match.

🌟 Features

  • 🧠 Self-learning: Learns new Q&A on the fly and stores them in qa.csv.
  • πŸ—£οΈ Text-to-Speech: Speaks answers using pyttsx3.
  • πŸ’Ύ Cached model: Downloads once from Hugging Face, loads instantly after.
  • 🧩 Expandable: Add more Q&A to boost its brainpower.
  • 🧘 CPU-friendly: Runs smoothly on laptopsβ€”no GPU needed!

βš™οΈ Installation

Clone the repository:

git clone https://github.com/goldstac/Lightweight-QA-Bot.git
cd Lightweight-QA-Bot

Install required Python modules:

pip install pandas scikit-learn pyttsx3 sentence-transformers numpy

πŸ’‘ Note: CPU-friendly version. No TensorFlow or GPU required.

πŸ’¬ Usage

  • Make sure qa.csv exists (MiniBot will create it if missing).

  • Run the chatbot:

    python index.py
  • Chat with MiniBot!

    • Type a question and wait for a response.
    • If MiniBot doesn’t know the answer, it will ask you to teach it:
      • MiniBot: I don't know, can you teach me?
      • You (teach MiniBot): [Type your answer here]
      • MiniBot will remember it for next time.
  • Type .exit or .quit to close the chatbot.

πŸ§ͺ How It Works

  1. Loads all Q&A pairs from qa.csv.
  2. Converts questions into embedding vectors.
  3. Finds the closest match using cosine similarity.
  4. If similarity < 0.4, it asks you to teach it.
  5. Saves new Q&A and updates embeddings dynamically.

🧾 Example

You Β» Hello

MiniBot Β» Hi there!

You Β» Who is Trump?

MiniBot Β» I don't know, can you teach me?

You (teach MiniBot)
∘ Donald Trump is the 47th president of the USA

MiniBot Β» Got it! I'll remember that.

You Β» Who is Trump?

MiniBot Β» Donald Trump is the 47th president of the USA

πŸ“¦ Dependencies

  • pandas
  • scikit-learn
  • pyttsx3
  • sentence-transformers
  • numpy

πŸ“œ License

MIT License β€” see LICENSE for details.
Feel free to fork, remix, and contribute! πŸ› οΈ

πŸ“ Notes

  • Model is cached locally in MinibotModelCache folder to avoid repeated downloads.
  • Works fully on CPU; no GPU or TensorFlow needed.
  • The more you teach MiniBot, the smarter it gets! πŸ§ πŸ’‘

About

A lightweight, CPU-friendly chatbot that learns from your Q&A and responds in real-time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages