A Retrieval-Augmented Generation (RAG) pipeline that downloads public-domain books from Project Gutenberg, indexes them using Sentence Transformers and FAISS, and performs semantic search, question answering, and text summarization using Transformer models.
The project also includes an interactive Gradio web application.
- 📖 Download books from Project Gutenberg
- 🧹 Preprocess and clean text
- 🔍 Semantic search using Sentence Transformers
- ⚡ Fast vector retrieval with FAISS
- ❓ Question Answering using BERT
- 📝 Text Summarization using BART
- 🌐 Interactive Gradio interface
- 🎯 Optional model fine-tuning
Project Gutenberg Books
│
▼
Text Preprocessing
│
▼
Paragraph Segmentation
│
▼
Sentence Embeddings
│
▼
FAISS Index
│
▼
User Question
│
▼
Semantic Retrieval
│
▼
┌───────────────┬───────────────┐
│ │ │
▼ ▼ ▼
Question Summary Retrieved
Answer Generation Context
rag-book-qa-summarizer/
│── notebook.ipynb
│── README.md
│── requirements.txt
│── .gitignore
│── LICENSE
│── images/
└── sample_data/
git clone https://github.com/<your-github-username>/rag-book-qa-summarizer.git
cd rag-book-qa-summarizerpython -m venv .venv
.\.venv\Scripts\Activate.ps1If PowerShell blocks activation:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\.venv\Scripts\Activate.ps1python3 -m venv .venv
source .venv/bin/activatepython -m pip install --upgrade pip
python -m pip install -r requirements.txtjupyter notebookor
jupyter labOpen notebook.ipynb and run all cells.
- Python 3.10+
- Git
- Jupyter Notebook or JupyterLab
| Task | Model |
|---|---|
| Embedding | sentence-transformers/all-MiniLM-L6-v2 |
| Alternative Embedding | sentence-transformers/multi-qa-mpnet-base-dot-v1 |
| Question Answering | bert-large-uncased-whole-word-masking-finetuned-squad |
| Summarization | facebook/bart-large-cnn |
| Vector Search | FAISS (IndexFlatL2) |
What are the main causes of soil erosion?
Soil erosion is primarily caused by water, wind, and unsustainable agricultural practices.
Soil erosion results from natural forces and poor land management.
- Hybrid Retrieval (BM25 + Dense Retrieval)
- Multi-document Retrieval
- Docker Support
- FastAPI REST API
- GPU Acceleration
- Multi-language Support
- RAGAS Evaluation
Add screenshots of the Gradio interface here.
images/demo.png
Example:
Contributions are welcome!
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Push to your branch.
- Open a Pull Request.
This project is licensed under the MIT License.
This project makes use of the following open-source projects:
- Hugging Face Transformers
- Sentence Transformers
- FAISS
- Gradio
- Project Gutenberg