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.
- π§ 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!
Clone the repository:
git clone https://github.com/goldstac/Lightweight-QA-Bot.git
cd Lightweight-QA-BotInstall required Python modules:
pip install pandas scikit-learn pyttsx3 sentence-transformers numpyπ‘ Note: CPU-friendly version. No TensorFlow or GPU required.
-
Make sure
qa.csvexists (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
.exitor.quitto close the chatbot.
- Loads all Q&A pairs from
qa.csv. - Converts questions into embedding vectors.
- Finds the closest match using cosine similarity.
- If similarity < 0.4, it asks you to teach it.
- Saves new Q&A and updates embeddings dynamically.
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
- pandas
- scikit-learn
- pyttsx3
- sentence-transformers
- numpy
MIT License β see LICENSE for details.
Feel free to fork, remix, and contribute! π οΈ
- Model is cached locally in
MinibotModelCachefolder to avoid repeated downloads. - Works fully on CPU; no GPU or TensorFlow needed.
- The more you teach MiniBot, the smarter it gets! π§ π‘